views:

49

answers:

1

I want to know if there is anything that you cannot do with SDK that was exposed in the COM interface?

+3  A: 

The OpenXML SDK is a convenience layer for the OpenXML file format. Using this SDK you can do everything that is possible to do with the file format, e.g. insert, modify and remove content, metadata and formatting.

In contrast to COM automation of Office you can't do anything that is related to application logic. To give you some examples: Using the OpenXML SDK, you can't know the page number of a certain element in a text document because that would require pagination, you can't recalculate the formulas of a spreadsheet because that requires Excel's math engine, or you can't convert a presentation slide into an image because that requires PowerPoint to render the slide.

Regarding Word, you can have a look at the following presentation which demonstrates when to use the OpenXML SDK vs. Office automation:

Open XML SDK + Word Automation Services Presentation at PDC

0xA3
+1. Exactly. The easiest way to think about it (at least for me) is that the SDK doesn't actually *render* anything, it just adds or deletes from what the rendering will be if you open the the file with a client app (such as Word) that will interpret the format and render it. Here's an example of an issue on SO that demonstrates a rendering problem: http://stackoverflow.com/questions/2638046/how-to-split-table-to-new-powerpoint-slide-when-content-flows-off-current-slide-u/. Personally, I hardly ever use the SDK because it doesn't offer anything I can't do on my own with `System.IO.Packaging`.
Otaku
@Otaku: Did you have a look at version 2.0 of the SDK which gives you fully-typed access to the file format model (for text documents)? This comes in handy e.g. in combination with Linq, or when creating documents because this doesn't require you to work on XML level. But of course, no additional functionality, just some more convenience on top...
0xA3
@0xA3: Yeah, I've looked throught 2.0. I do most of my work in the XML formats anyway with Linq-to-XML, so it doesn't offer me anything. I started with the markups by hand, so it's just more comfortable and convenient for me. Not saying that the SDK is worthless though, I've used it plenty in the last 6 months, especially when trying to learn a new concept and all the code examples and samples are from the SDK. I'd definetely recommend it for others as well if just starting out with Open XML programming - it's far easier than rolling your own routines to do things like set up relationships.
Otaku