openxml-sdk

Open Office xml SDK exception “Cannot insert the OpenXmlElement ”newChild“ because it is part of a tree”

大兔子大兔子 提交于 2019-12-13 02:08:10
问题 I am generating a a word document using open office sdk 2.0. I am getting an exception with is "Cannot insert the OpenXmlElement "newChild" because it is part of a tree." I am aware that is exception is due to trying duplicate nodes within the xml but I am not sure how to fix it. private void GenerateWord(string Path) { using (WordprocessingDocument WpDoc = WordprocessingDocument.Create(Path, WordprocessingDocumentType.Document, true)) { MainDocumentPart MainPart = WpDoc.AddMainDocumentPart()

Minimal style sheet for Excel Open XML with dates?

孤人 提交于 2019-12-13 00:39:43
问题 I'm trying to create an Excel file using the Open XML SDK with the minimal style sheet needed that will allow me to format a cell as a date. Below is my attempt at a style sheet: <?xml version="1.0" encoding="utf-8"?> <x:styleSheet xmlns:x="http://schemas.openxmlformats.org/spreadsheetml/2006/main"> <x:cellXfs count="1"> <x:xf numFmtId="14" xfId="0" applyNumberFormat="1" /> </x:cellXfs> </x:styleSheet> Even without referencing this style from a cell, Excel tells me that my file is corrupt. If

keep table(rows) together with OpenXML SDK 2.5

我是研究僧i 提交于 2019-12-12 20:56:21
问题 I'd like to generate multiple tables with 2 rows each inside of a word document. But I want to keep these two rows together (if possible). new KeepNext() on the first row doesn't work new KeepNext() on the last paragraph of the first row doesn't work new CantSplit() on the table doesn't work In all cases the second row (if too large) lands on the second page. A new CantSplit() on the last cell ( the one with large content) avoids a break of the cell. But none of the options avoids a split of

How to insert an Image in WORD after a bookmark using OpenXML

萝らか妹 提交于 2019-12-12 18:28:57
问题 I am using a word document which has a bookmark inside that. My requirment is to insert an icon after each bookmark using OpenXML 2.0 with C# 4.0. I tried to use Image content control and the reflected code from OpenXMLSDK tool. Somehow it got worked but now I am getting the full size controls. Also each image has an icon into that for change picture. Can anyone tell me that how can I reduce the size of the picture content control and if possible remove that extra icon. Also, if anyone has

Restart page numbering in header with OpenXML SDK 2.0

送分小仙女□ 提交于 2019-12-12 11:58:30
问题 I can't figure out how to start the page numbering at a specific point for a section using OpenXML SDK 2.0. Here's what I see when I reflect on a header in a document using the OpenXML Productivity Tool: <w:hdr xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m=

OpenXML SDK 2.0 vs Aspose for server side word 2007 document generation in .NET

 ̄綄美尐妖づ 提交于 2019-12-12 10:35:28
问题 I am going to start a Server side Office automation project in .Net. Below are the key activities that are planned: Create a word document Use a existing word document template having cover page, header, footer, TOC Save file Embed files and resize : HTML, Image, Word, Excel TOC generation and formatting Doc formatting: Page break, Section break, Orientation, Orientation at section break, Continuous page numbering Replace embedded "variables" with use defined contents. I am more inclined

Excel and “unreadable content” when creating an Open XML spreadsheet with MemoryStream

谁说我不能喝 提交于 2019-12-12 08:27:15
问题 When creating an Excel spreadsheet using the Open XML SDK v2.0, our Excel output initially worked successfully for a number of months. Recently Excel (all versions) began to complain about "Excel found unreadable content in 'zot.xlsx'. Do you want to recover the contents of this workbook?". We are creating the file in a web application, using a MemoryStream as the store, which is then sent as a byte[] in an HTTP response with a MIME type of "application/vnd.openxmlformats-officedocument

Embed contents of a RTF file into a DOCX file using OpenXML SDK

南楼画角 提交于 2019-12-12 08:23:34
问题 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 the contents of RTF files into the generated DOCX... specifically we replace a bookmark with the contents of the file. I found a few examples online but they all differ.

OpenXML- Set a slide layout for a slide in presentation

ぃ、小莉子 提交于 2019-12-12 04:49:08
问题 Here is the code i used to create the presentation. What i'm trying here is to create a slide and insert shapes into it and attach the slide into already created presentation. That works fine. My question is how i set the layout the of the inserted slide. what i mean slide layout here is slideLayoutpart.SlideLayout = new SlideLayout() { Type = SlideLayoutValues.VerticalTitleAndText }; I want to set this layout to my Slide. I had looked working with slidelayout HERE Slide slide = new Slide(new

How to add an hyperlink to a shape in a presentation using OpenXml SDK

∥☆過路亽.° 提交于 2019-12-12 02:13:21
问题 I am developing with C# application to create a PowerPoint presentation. I am using the OpenXML SDK 2.0 and MS Office PP 2007. I am able to clone my slides from my template and add a new shape on it. But now i want to add a Hyperlink to my shape. How can i do this? I found this: tutorial but i need to add those hyperlinks at runtime. I already tried this. SlidePart currentSlidePart = CloneSlidePart(presentationPart, slidePart); Slide s = currentSlidePart.Slide; currentSlidePart