openxml-sdk

OpenXML SDK: Updated text in HeaderPart not getting saved

elem is obtained by searching various document parts, both MainDocumentPart.Document and HeaderParts: Text text = elem.GetFirstChild<Text>(); System.Console.Write("Updating content from '{0}'", text.Text); text.Text = "blah"; System.Console.WriteLine(" to '{0}'", text.Text)...

Is there functionality that is NOT exposed in the OpenXML SDK v2?

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

From Excel to DataTable in C# with Open XML

I'm using Visual Studio 2008 and I need create a DataTable from a Excel Sheet using the Open XML SDK 2.0. I need to create it with the DataTable columns with the first row of the sheet and complete it with the rest of values. Does anyone have a example code or a link that can help me to do this? ...

How can I embed any file type into Microsoft Word using OpenXml 2.0

I spent a lot of time trying to figure out a good way to embed any file into Microsoft Word using OpenXml 2.0; Office documents are fairly easy but what about other file types such as PDF, TXT, GIF, JPG, HTML, etc.... What is a good way to get this to work for any file type, in C#? ...

what exactly does the SDK v2 take care of that you would have to do manually when coding by hand with an XML library?

This is closely related to another question I asked: Is there functionality that is NOT exposed in the OpenXML SDK v2? I am currently working with OpenXML files manually. I recently had a look at the SDK and was surprised to find that it looked pretty low level, quite similar in fact to the helper classes I have created myself. My quest...

OpenXML SDK: Embed DOC/RTF file in DOCX

In our old MSWord-97 based system we use COM to interact with a .doc file, and embed an OLE object, so the embedded document is visible in the parent (not as an icon). We're replacing this with a system using OpenXML SDK since it requires having Word on our server, which generates .docx files. however we still need to embed files in the...

Automated Testing OpenXML SDK

Hi, I'm implementing ms word document generation using content controls and OpenXML SDK. I'd like to have some automated testing for that code (unit tests or some easy UI automation tests). Does anyone has expericnce with testing MS Word document generation? What are the possible options? Thanks in advance! ...

Inserting/embedding a file to a DOCX file - determining file-type

Let's say I have an API which lets clients insert a file into a DOCX template, they just pass a path to the file. If it's an image I just want to add an image to the file, if it's something life RTF/DOC then I can maybe embed it so the content is visible, if it's some other type like MP3 or PDF then it might simply embed with an icon. I...

How to add a comment to a cell in Excell 2007 using the Open XML SDK 2.0?

I'm posting this question and answer to help anyone else that might need this bit of code in the future. I had a hard time finding a complete code sample or even an explanation of how to add a comment to an Excel cell. Hopefully this will help someone in the future. ...

Copy docx from template and use it as new

Hi everyone, I'm using a "template.docx" to copy to my "newDoc.docx" to use some predefined styles or illustrations. But with this new content, i want to update fields and my table of contents, so it's easy to do it with a vba script, the user don't have to do anything. But i have a problem, i juste want one execution at the first ope...

Office OpenXml: How to get rid of "Click here to enter text" for literal content control with xml generated from serializer

Possible Duplicate: How to get rid of Click here to enter text for literal content control with xml generated from serializer Hello, This issue occurs when you have your content control mapped to xml that doesnt have closing tag and the xml value is empty string or null. For eg. if the xml is and is mapped to literal contro...

How to get rid of "Click here to enter text" for literal content control with xml generated from serializer

Hello, This issue occurs when you have your content control mapped to xml that doesnt have closing tag. For eg. if the xml is and is mapped to literal control than on mapping the text displayed on word document(enable editing or printing) with be something like this Click here to enter text even if you have removed the text when you ...

Error opening large documents created by OpenXML SDK

Hi everyone! I would like to ask if there are any limitations concerning the size of a document created by OpenXML SDK? I have been creating documents that contain headings, tables and paragraphs, and everything works fine, but lately I tried to create a document with 285 chapters - each containing seveal headings, paragraphs and table...

Merge multiple <Body> (xml) word documents to 1 document

I have multiple <body> tags from an word document. I do this with the open xml sdk. So the new document should generated with openxml The body's comes from WordprocessingDocument.Open("C:\Temp\Test.docx").MainDocumentPart.Document.Body.OuterXml I have so different body's in a list. With al different values. Changed some text in the x...

Programming Word XML in .NET

I'm currently in a development team trying to come up with an app that will be able to accept an Open XML Word document, shred the XML and somehow come up with UI screens on the fly that could be used for data entry. I'm using the Open XML SDK but my challenge has been to come up with a very generic means of representing the document as...

Link to Microsoft Open XML SDK tutorials

Anyone know any link to a good Microsoft Open XML tutorials? ...

WordML templating with XML Schema and OpenXML SDK

I'm trying to use a docx read in via the OpenXML SDK as template in a .Net web app for form letters (essentially). I have a docx with the formatting I want, marked up with XML Schema tags defined from a xsd (whatever they're called, the help is exceedingly useless on this). The only thing similar I found on Google was what seemed to be ...

ASP.NET: Download Powerpoint file with Save as....

I'm generating a PowerPoint file using this as reference. A user can search other users based on many criterias. Information based on the user is saved in the PowerPoint file. But I can't save all PowerPoint files on the server. So, the user needs to right click a link, choose "Save as", and save the file locally. Nothing should be s...

How do I add an XML Map programmatically to an Excel 2010 Spreadsheet?

I have a basic XML file, which I need to add as an XML Map to an Excel 2010 Worksheet. How do I do this programmatically? I would prefer a solution which uses Microsoft OpenXML SDK. ...

Open xml SDK Save a template file (.xltx to .xlsx)

I have the following code to open excel template file and save it as .xlsx file and I get the error below when I try to open the new file. Please help to resolve this. Excel cannot open the file ‘sa123.xlsx’ because the file format or the extension is not valid. Verify that the file has not been corrupted and that the file extension mat...