openxml-sdk

Open XML Table Header Same page

江枫思渺然 提交于 2020-01-04 05:56:34
问题 I am making an OpenXML document generator. It generates Word Documents based on system data. I Have table headers set up and they work a treat. My issue is as follows: In particular circumstances (if the header fits on the page, but the next row doesn't) it will show the header, then there will be the page break and it will show again on the new page. This is of course expected behavior, and is fixed by manually going into the generated document and adding a new line or two before the table,

Open XML Table Header Same page

有些话、适合烂在心里 提交于 2020-01-04 05:56:25
问题 I am making an OpenXML document generator. It generates Word Documents based on system data. I Have table headers set up and they work a treat. My issue is as follows: In particular circumstances (if the header fits on the page, but the next row doesn't) it will show the header, then there will be the page break and it will show again on the new page. This is of course expected behavior, and is fixed by manually going into the generated document and adding a new line or two before the table,

Resize existing image in DocX using OpenXML sdk

房东的猫 提交于 2020-01-04 04:03:10
问题 Got template docx with image placeholder which replaced by correct picture. private void SetImagePartData(ImagePart imagePart, byte[] data) { if (imagePart != null) { using (var writer = new BinaryWriter(imagePart.GetStream())) { writer.Write(data); } } } but it preserves placeholder size. How to change it to actual image size? Byte array is aqquared from image on server, so size is known. 回答1: If you mean a content control with your placeholder you can use following code I once needed: //Get

How can an OpenOffice document be created in C++ [duplicate]

≡放荡痞女 提交于 2020-01-02 08:29:07
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: Creating, opening and printing a word file from C++ Hi, I need to create a word document from a c++ program, Im using windows 2008 server,office automation fails sometimes here and also I need non interactive service to handle as automation provides interactive service.I've implemented automation it fails sometimes What are the ways I can create openoffice / word doc? can you please suggest me any links or

How to use a gradient fill (GradientFill) with ClosedXML

為{幸葍}努か 提交于 2020-01-02 03:57:05
问题 I'm working on a C#/ASP.NET web thing and want to do an Excel export. First I found OpenXML, made some first steps, but it's really hard to use. Now, I'm using ClosedXML and it's quite a relief - so far. I came up with the problem to have a gradient fill on a table cell ... no problem with normal fills like worksheet.Cell(1,1).Style.Fill.SetBackgroundColor(XLColor.Red); or with Patterns like worksheet.Cell(1,1).Style.Fill.PatternType = XLFillPatternValues.LightHorizontal; worksheet.Cell(1,1)

How to add a row to Excel using OpenXML SDK 2.0?

泄露秘密 提交于 2020-01-01 19:17:14
问题 I am new to OpenXML and have been struggling with adding a new row with cell data in A1 after a row (with cell data as well) has been added. So essentially I want to insert "Test" in "row 1" column "A1" and "test" in "row 2" column "A1". Here is my code, it looks sound and creates the file however Excel does not open it. I opened it in OpenOffice and it only shows one row instead of two. When I comment out appending row2 to the sheetdata, it works fine. So I am thinking am creating the 2nd

Is there an alternative to open-xml sdk to generate word documents

别来无恙 提交于 2020-01-01 16:47:22
问题 I'm trying to generate word documents using open xml sdk. When the documents are small this is no problem (and rather easy). When the documents become larger (+500 pages) I notice the peformance (duration, memory usage, ...) goes down significantly. Googling this problem I came across some posts that point out the same problem. For excel there is a solution with spreadsheetgear. I would like to know if there is a word alternative to this or if there are other solutions to generate word

OpenXML replace text in all document

*爱你&永不变心* 提交于 2020-01-01 03:01:08
问题 I have the piece of code below. I'd like replace the text "Text1" by "NewText", that's work. But when I place the text "Text1" in a table that's not work anymore for the "Text1" inside the table. I'd like make this replacement in the all document. using (WordprocessingDocument doc = WordprocessingDocument.Open(String.Format("c:\\temp\\filename.docx"), true)) { var body = doc.MainDocumentPart.Document.Body; foreach (var para in body.Elements<Paragraph>()) { foreach (var run in para.Elements

How to add text on desired coordinates on new word file using openxml

不问归期 提交于 2019-12-31 03:46:10
问题 I want to create .docx file using openxml and add text on desired coordinates(location) on each page of the file. Is there any way in openxml to adjust the text. I am using the following snippet: WordprocessingDocument doc = WordprocessingDocument.Create("E:\\test11.docx", DocumentFormat.OpenXml.WordprocessingDocumentType.Document); { MainDocumentPart mainPart = doc.AddMainDocumentPart(); mainPart.Document = new Document(); Body body = mainPart.Document.AppendChild(new Body()); Paragraph para

OPEN XML to Export 2007/2010

两盒软妹~` 提交于 2019-12-30 11:35:43
问题 In my application I already have functionality to export into 2003 format. Where I am constructing a string out of the template and write using System.IO.File.WriteAllText. But it does not work with excel 2007/2010, that's why I wanted to convert it to Openxml in order to support 2007 and 2010. I have string ready with creation of cells and rows from template. I want advice on how to achieve or any body has reference link. Please let me know. Regards 回答1: WriteAllText class will save you a