This project has moved and is read-only. For the latest updates, please go here.

Get access to underlying spreadsheet document

May 17, 2012 at 5:01 PM

Is there any method to get access to the underlying OpenXML Spreadsheet document?  Or is the only option to save the file and reopen it directly with the DocumentFormat.OpenXML API.  If there is no way to get access to the underlying object can a method or read only property be added that exposes access to it?

May 17, 2012 at 5:16 PM

Nope. The library has no idea what the OpenXML file is going to look like until you save it.

May 24, 2012 at 4:34 PM

Could you add a method to get the underlying document that internally saves the document into a memory stream and then return the open xml document?  Something like workbook.GetOpenXmlDocument().  I have a need to add in additional additional parts not yet supported by this API (which is great btw).

May 24, 2012 at 4:40 PM

That already exists: workbook.SaveAs(stream)

May 24, 2012 at 4:43 PM

I know the SaveAs method exists.  I was just hoping to have a method so that I wouldn't have to write the additional code to read that into an OpenXml document.  If you don't think it makes sense in the API that's fine.  I was thinking this would be a nice to have feature.

May 24, 2012 at 6:19 PM

What you call the OpenXML document (singular) is actually a collection of files in a folder structure (plural). When it comes to OpenXML files getting "the xml document" doesn't make sense. There's a reason why OpenXML documents are called packages. This is what you get with the SaveAs, a package with all the XML files that make up the OpenXML "document".