I built a template-based document generator using the Open XML SDK (1.0), the Word 2007 Content Control Toolkit and LINQ to SQL (using the CodeSmith PLINQO templates). To do this, I serialized the LINQ to SQL entities to XML by retrieving the entity using DataLoadOptions specified in the source code.
This works great, except that to ini...
I'm using the Open XML SDK to work with Word 2007 templates, and the project continues to progress nicely. Now I would like to add consistent headers and footers to every document, very similar to an ASP.NET MasterPage. In particular, I'd like to compose a template document with a content document, then fill the content using the approac...
I need to union two sets of XElements into a single, unique set of elements. Using the .Union() extension method, I just get a "union all" instead of a union. Am I missing something?
var elements = xDocument.Descendants(w + "sdt")
.Union(otherDocument.Descendants(w + "sdt")
.Select(sdt =>
...
I am trying to start working with excel documents through the OpenXML SDK Spreadsheet API.
But I havent found any good guides or even examples on how to create a xlsx file from scratch. Only how to open an existing document and modify it.
I have been thinking on having a empty template document and make a copy of it an then begin my pro...
The code runs, but corrupts my excel document. Any help would be mucho appreciated! I used this as a reference.
public void AddRow(string fileName, string[] values) {
using (SpreadsheetDocument doc =
SpreadsheetDocument.Open(fileName, true)) {
SharedStringTablePart sharedStringPart =
...
I'm generating XLSX spreadsheet using OOXML SDK, and I need to get rid of x: namespace prefix. How can I achieve this?
using (SpreadsheetDocument doc = SpreadsheetDocument.Open("template.xlsx", true))
{
//Save the shared string table part
if (doc.WorkbookPart.GetPartsOfType().Count() > 0)
...
I need to traverse nodes between a bookmark start and a bookmark end tag. The problem appears to break down into a tree traversal but I am having trouble pinning down the correct algorithm. The bookmark start and end elements are non-composite nodes (no children) and may appear at an arbitrary depth in the tree. Bookmark start are als...
Hi
I want to create a word 2007 document without using object model. So I would prefer to create it using open xml format. So far I have been able to create the document. Now I want to add a content control in it and map it to xml. Can anybody guide me regarding the same???
...
Do anyone come across a performance issue when deleting a first row in a 20,000+ rows Excel file using OpenXML SDK v2.0?
I am using the delete row coding suggested in the Open XML SDK document. It takes me several minutes just to delete the first row using Open XML SDK, but it only takes just a second in Excel applicaton.
I eventually ...
Hello,
I'm trying to read Word 2007 docx document.
The document looks fine inside Word, but when i try to read id using my code, all Run objects have RunProperites set null.
The property that I'm most interested in is RunProperies.FontSize, but unfortunately it is null as well, the only property I can access is InnerText.
My Code l...
How can I read word-by-word (with styles) from a docx file. I want to compare two docx files word-by-word and based on the differences I have to write into another docx file (using c# and OOXML).
I have tried achieving this by using DocumentFormat.OpenXml.Extensions.dll, OpenXMLdiff.dll and ICSharpCode.SharpZipLib.dll but nothing is givi...
Hi
I am at my whits-end with this problem. I can successful bind xml to the main document part, however I cannot seem to be able to get content controls in the header to bind to the xml.
AddCustomXmlPart doesn't seem to exist for Headerpart and if I try to add a CustomXmlPart via hdrpart.AddPart(xmlPart);
I get an Invalid operation ...
I'm trying to merge two docx-documents into one docx-document using OpenXML SDK 2.0. The documents should be merged without loosing their styling and custom headers and footers. I hope I can achieve this using AltChunk and a section break. But I can't get it working.
Is it possible what I'm trying to do? Can someone give me a hint how t...
Just posting the solution I worked out today. See my answer below.
If you don't have the very helpful OpenXML SDK v2.0 Tool, you can find it at http://www.microsoft.com/downloads/details.aspx?FamilyID=C6E744E5-36E9-45F5-8D8C-331DF206E0D0&displaylang=en
If you know the purpose of the lines I commented with "I don't know...", please...
Is there anyway to use the Open Office SDK 2.0 to save a PowerPoint presention that you created using OOXML to a PowerPoint 2003 presentation? I know if you open a 2007 file and click Save As you have the option to save it as a PowerPoint 97 to 2003 document and I didn't know if I could do this grammatically using this SDK.
The reaso...
In C# ASP.NET 3.5 web application, I need to export multiple datatables (or a dataset) to an Excel 2007 file with multiple sheets, and then provide the user with 'Open/Save' dialog box, WITHOUT saving the Excel file on the web server.
I have used Excel Interop before. I have been reading that it's not efficient and is not the best appro...
We are trying to generate MS Excel workbook using OOXML and populate data using SSIS.
We are able to generate Workbook and sheets, also able to create columns and insert data in the Header cell. We can also populate data using SSIS.
But the Sheet (DocumentFormat.OpenXml.Spreadsheet.Sheet) and all cells (DocumentFormat.OpenXml.Spreadshee...
I have a bunch of data that I need to export from a website to a PowerPoint presentation and have been using Open XML SDK 2.0 to perform this task. I have a PowerPoint presentation that I am putting through Open XML SDK 2.0 Productivity Tool to generate the template code that I can use to recreate the export.
On one of those slides I...
I'm looking for some options to programmatically create a Word document from within a Silverlight 4 application. I found two approaches which seemed promising at first but don't look like they will work.
OpenXML SDK
The OpenXML SDK isn't available for Silverlight at this time.
Word Automation via COM Interop
dynamic wordApplication =...
I update some cells of an Excel spreadsheet through the Microsoft Office OpenXML SDK 2.0. Changing the values makes all cells containing formula that depend on the changed cells invalid. However, due to the cached values Excel does not recalculate the formular, even if the user clicks on "Calculate now".
What is the best way to invalida...