openxml

I am merging two Word documents with OpenXML SDK but get a corrupt document when copying an image into a header

懵懂的女人 提交于 2019-12-12 10:03:30
问题 I have code which works in all sorts of different situations, including when copying images into the body of the document. The code works when copying (adding) headers and footers from one document to the other, as long as the headers/footers being copied do not contain images. When I copy a header which has an image in it, then the resulting file is corrupt, and when I try to open it with the OpenXML SDK it throws an exception saying "Compressed part has inconsistent data length". I do know

Insert comment in Word using office.js

混江龙づ霸主 提交于 2019-12-12 10:03:13
问题 I am trying to make a Word add-in in office.js that inserts comments in the document. It seems to me the only way to achieve this is to use OOXML. I can insert the comment but my problem is that when I do so a paragraph break is inserted as well as can be seen from this image. A far as I can see it boils down to that if I am only inserting some text the content of the body looks like the following which works fine <w:p> <w:r> <w:t>Some text</w:t> </w:r> </w:p> But if I am inserting a

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.

export to excel through mvc3

こ雲淡風輕ζ 提交于 2019-12-12 08:18:05
问题 Hello everyone i am trying to export some data to excel in the form of table in mvc3.Here is the class i am using to generate the excel file: //------------------------------------------------------------------------------ // <copyright file="ExcelDocument.cs" company="Microsoft"> // Copyright (c) Microsoft Corporation. All rights reserved. // </copyright> // <summary>The Export to Excel Document class.</summary> // ----------------------------------------------------------------------------

Inserting text after a bookmark in openxml

青春壹個敷衍的年華 提交于 2019-12-12 08:00:12
问题 I am looking for a way to insert some text after a bookmark in a word doc using openxml. So far, i have been able to locate the bookmark using the following: var bookmarks = mainPart.Document.Descendants<BookmarkStart>().ToList(); var bookMarkToWriteAfter = bookmarks.FirstOrDefault(bm => bm.Name == insertAfterBoomark.Name); This bookmark in the word doc is a selection of two lines in the doc. I have to insert some text right after the two line selection. I have tried to insert text using the

Saving Word DOCX files as PDF [closed]

不羁的心 提交于 2019-12-12 07:15:37
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last year . I'm using openxml to create Word DOCX files. I'd like to save these documents once they are created as PDF files. Is there a way I can do this in openxml? I assume the answer is no. If it is no, is there a recommended library or tool I can use to save / print DOCX files as PDF (programatically, in .NET)? I looked

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

What units is transparency stored in ooxml?

扶醉桌前 提交于 2019-12-12 04:45:07
问题 I have a pptx file with a single shape. Setting it to 70% transaprent I can compare the pptx and see the only difference is in /ppt/slides/slide1.xml <a:solidFill> <a:schemeClr val="accent1"> <a:alpha val="40000"/> </a:schemeClr> </a:solidFill> Anyone have any idea how on earth "70%" translates to "40000"? 回答1: It seems different for me. My alpha values seem to use this function: y = -1000x + 100000 Where x is the percentage and y is the alpha value. I recommend you do the same (figure out a

Replace bookmark contents in Word using OpenXml

ぐ巨炮叔叔 提交于 2019-12-12 04:35:20
问题 I can't find any working code examples for replacing bookmark contents. The code should be able to handle both the case replace empty bookmark and replace bookmark with preexisting content. For example: If I have this text in a Word document: "Between the following periods comes Bookmark1.. Between next periods comes Bookmark2.." and I want to insert the text "BM1" between the first periods, and "BM2" between the next. After the first replacement run, the replacements are inserted correctly.