15

I'm curious as to how many people are using Open XML (OOXML) these days (either pure or via the SDK) in closed and commercial environments. I'm fairly aware of what's going on on the 'public web' (MSDN, OpenXMLDeveloper.org, etc.), but am wondering about SO people's experience with it, both good and bad.

Are most people opting out of VBA and VSTO in favor of working directly with OOXML formats? What benefits are you getting from OOXML that you're not getting from the object model. I'd love to learn more about why you're using it or why you're not, what are you using it for, etc.

I'm just trying to get a feel from the community on OOXML as an approach toward document automation or other uses. I'm not finding community forums (this one or others) to be incredibly active with questions and users (check out the number of questions by tag of this post), so I'm wondering if I'm one of the very few who is using OOXML extensively.

Todd Main
  • 28,951
  • 11
  • 82
  • 146

8 Answers8

9

Now that Microsoft Office 2007 (and especially Excel) support Open XML, I'm finding it far easier to work with than Office Automation. A few major reasons for this are:

  • Better performance;
  • No flakey IPC issues (i.e. somebody left Excel open at the Save As dialog, crash);
  • No dependency on Office itself, or any external components whatsoever;
  • Fairly easy to write Linq extensions and queries against in C#;
  • Can be used in server environments without any problems or risks.

Given that Office XP/2003 users can open Office 2007 files with the Compatibility Pack, I don't see any reason to continue using the old automation or "OfficeML" methods. It's a bit of a learning curve, but it's arguably the best option today - it's free, it's reliable, and best of all it's the native format used by Office 2007 today and you don't need any stupid tricks to get it to work (like attaching the XLS content-type to HTML as we did for XL2003, and having XL2007 complain about an incorrect extension).

I wouldn't say it's an outright replacement for VBA/VSTO - the thing about those is that they're usually part of a solution where the requirement is to integrate with the Office environment itself. Using OOXML would generally require you to write an entire application around it. But for simple import/export, which is probably what 90% of automation has been used for in the past, definitely, OOXML is the way to go.

Aaronaught
  • 120,909
  • 25
  • 266
  • 342
  • 2
    One concern with Open XML is if you still have a lot of users using Office 2003 and you are creating documents from scratch (i.e. not using Word or Excel). I've ran into some problems where I would create the file with the Open XML SDK and it would open fine in Office 2007, but when someone tried to open it in Office 2003 using the Compatibility Pack, it would crash. Just a FYI to test both versions of Office before releasing a document. – Adam Sheehan Jan 04 '10 at 11:45
  • @Adam: Interesting, I've never gotten a bug report about this, but I'll definitely be testing it from now on. – Aaronaught Jan 04 '10 at 15:33
  • I've recently started using OpenXML and it's way more faster than using the Interop. However one drawback I've faced is executing macros with OpenXML. So if you need to execute macros on your Excel sheet you're definitely out of luck! – QV1 Sep 16 '14 at 13:42
4

Libraries like Simple OOXML can also greatly help with the learning curve.

James Westgate
  • 11,306
  • 8
  • 61
  • 68
2

We are using Open XML SDK for export to Excel. I have to say it is quite slow so we had to do some caching on our own (for shared strings). The library is just an object representation of the Open XML format. Sometimes it can be good thing, sometimes not. Especially when you have to know Open XML standard very well because the SDK won't handle anything for you. You have to know all the restrictions the format brings, you have to know which elements you cannot ommit in xlsx or docx, etc. It allows you to create inconsistent excel spreadsheets or word documents which is not good. Well, it's free at least :) Better than nothing.

rocky
  • 7,506
  • 3
  • 33
  • 48
1

I've used it to parse pptx files, looking for special comments in shapes. These comments are links to other resources (uri's most often, PDF files, etc.). I then use deepzoom software to render the pptx and then render the uri's inside the shape. Fun, but slow. Use it to help with research and a "novel" way to look at posters. But this isn't LOB.

Gordon
  • 3,012
  • 2
  • 26
  • 35
1

We migrated from Word Interop to Open XML very recently.

Our application is used for creating Invoices in the Word and pdf format. When Interop was used, a decent size Invoice took about 5-10 minutes to generate. Now, using OpenXML and SSRS that time has been reduced to approximately 30 seconds. The only problem area with Word was that some features were not backward compatible from Word 2010 to 2007 and that took some time to fix and get up and running. Like creating the Table of Contents, merging documents etc.

Other than that, I think Linq, MSDN and Eric White's Blog is enough to get you going in the right direction.

Varun Rathore
  • 7,730
  • 3
  • 27
  • 30
1

I have used Open Xml SDK for document generation in SharePoint, PPTX generation for custom presentations (pulling from XSLX for the data) and for "building" composite documents from multiple document segments.

The format and the SDK are great. No worries on the server in ASP.NET or SharePoint scenarios, and great speed. I have not found too many scenarios where the SDK or "brute force" xml cannot accomplish a goal. One instance is password protection and DRM for documents, but these are more corner cases. I would agree with aaronaught that this is not an exclusive solution, but SharePoint, VSTO and others are tools in the tool belt for document generation solutions.

Community
  • 1
  • 1
Pete Skelly
  • 775
  • 6
  • 16
  • That's interesting, the PPTX generation. Would that be a scenario, for example, like a sales person needs a custom deck for a particular customer and the backend uses the SDK to query on customer and data for insertion into a pre-built template? – Todd Main Jan 11 '10 at 01:09
  • Okatu. I have done almost exactly that. Our customer are very happy with the result. I have also used Excel and Word to both import and export information from our system. – Andrew Feb 06 '10 at 13:27
  • Okatu, we have had situations with Word very similar to what you describe (pulling data from SharePoint and other external systems) to generate DOCX documents. The PPTX is very similar - creating custom slides based on data from an Excel file. – Pete Skelly Feb 16 '10 at 13:05
1

I am doing the scenario that sales performance for a country is delivered in PPT Deck using Open XML

salgo60
  • 957
  • 5
  • 16
  • interesting. Are you using the SDK or writing directly? Are you doing more complex BI reporting like charts and graphs? – Todd Main Jan 19 '10 at 08:51
  • SDK 2.0 Beta But feel it is a pain to use. I use the reflector the charts are creating using SoftwareFx chart package. The data is sells data where follow up how the company deliver on 40 different markets and we look into Values/Volumes/ Percentage / Market Penetration in different segments/ Growth / Share of Growth so yes it is BI but using Linq for SQL – salgo60 Jan 19 '10 at 13:21
  • The usage is for deciding and motivating Discontinuation decisions on products on different markets – salgo60 Jan 19 '10 at 23:30
1

I looked at this technology a lot, I program in VBA, but it was way way to complex for my needs. There are some great things about using it that my elearning would benefit from, like Linq and XML, but the bar for going from VBA to the underlying formats is just too high and I don't have the luxury of the kind of time and money it would take investing in learning VS.Net and Open Office XML formats.

But the one thing I think it would really help with is meta-tagging PowerPoint content for an LMS.

Meihua
  • 241
  • 1
  • 9
  • 22
  • 1
    yeah, i suspected as much. making the change to .NET and other new technologies was a big leap from VBA. – Todd Main Feb 03 '10 at 22:33