openxml

Replacing Content Controls in OpenXML

若如初见. 提交于 2019-12-03 05:09:58
问题 I need something as a placeholder. I at first looked to Content Control as a solution but I'm having some problems with it. I then looked into adding CustomXML to the .docx but turned away from that because of the i4i lawsuit. Then I decided I would just plain change the text of the Content Control through OpenXML SDK 2.0 but even if it's so marked the Content Control doesn't go away. I guess that it doesn't know that the text changed unless it happens inside word. I could perhaps just remove

Beginner sample codes for the Open XML SDK? [closed]

隐身守侯 提交于 2019-12-03 05:06:35
问题 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 5 years ago . I recently started working on the Open XML SDK 2.0. I would like to know if there is any better documentation (instead of open xml sdk2.0 itself) or any other resource to learn working with the Open XML SDK? 回答1: Besides everything on MSDN, the most well-known place to learn Open XML and the SDK is http:/

Repaired Records : Cell information from worksheet created from scratch

微笑、不失礼 提交于 2019-12-03 04:46:27
问题 I'm receiving an error when opening my OpenXML created spreadsheet. The error is as follows. Repaired Records: Cell information from /xl/worksheets/sheet.xml part Repaired Records: Cell information from /xl/worksheets/sheet2.xml part Repaired Records: Cell information from /xl/worksheets/sheet3.xml part The only thing I could find online that was helpful was this issue was the discussion of an algorithm which alters an individual cell multiple times causing the issue. Having said that, I'm

How do you change the content of a content control in Word 2007 with OpenXml SDK 2.0?

跟風遠走 提交于 2019-12-03 03:21:42
About to go mad with this problem. I'm sure it's so simple I'm just missing it, but I cannot for the life of me find out how to change the content of a content control in Word 2007 with the OpenXml SDK v2.0 in C#. I have created a Word document with a plain text content control. The tag for this control is "FirstName". In code, I'd like to open up the Word document, find this content control, and change the content without losing the formatting. The solution I finally got to work involved finding the content control, inserting a run after it, then removing the content control as such: using

OpenXML 2 SDK - Word document - Create bulleted list programmatically

北城余情 提交于 2019-12-03 02:27:01
问题 Using the OpenXML SDK, 2.0 CTP, I am trying to programmatically create a Word document. In my document I have to insert a bulleted list, an some of the elements of the list must be underlined. How can I do this? 回答1: Lists in OpenXML are a little confusing. There is a NumberingDefinitionsPart that describes all of the lists in the document. It contains information on how the lists should appear (bulleted, numbered, etc.) and also assigns and ID to each one. Then in the MainDocumentPart , for

EPPlus error reading file

。_饼干妹妹 提交于 2019-12-02 23:39:05
问题 using code like using OfficeOpenXml; // namespace for the ExcelPackage assembly … FileInfo newFile = new FileInfo(@"C:\mynewfile.xlsx"); using (ExcelPackage xlPackage = new ExcelPackage(newFile)) { … } I get an exception error of 'IBM437' is not a supported encoding name. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method. Parameter name: name Any ideas as to what the problem could be? Thanks Martin 回答1: The problem is in the ZIP file

Simplify/ Clean up XML of a DOCX word document

断了今生、忘了曾经 提交于 2019-12-02 22:33:43
I have a Microsoft Word Document (docx) and I use Open XML SDK 2.0 Productivity Tool to generate C# code from it. I want to programmatically insert some database values to the document. For this I typed in simple text like [[place holder 1]] in the points where my program should replace the placeholders with its database values. Unfortunately the XML output is in some kind of mess. E.g. I have a table with two neighboring cells, which shouldn't distinguish apart from its placeholder. But one of the placeholders is split into several runs. [[good place holder]] <w:tc xmlns:w="http://schemas

how can I change the font open xml

廉价感情. 提交于 2019-12-02 20:33:10
How can I change the font family of the document via OpenXml ? I tried some ways but, when I open the document, it's always in Calibri Follow my code, and what I tried. The Header Builder I think is useless to post private static void BuildDocument(string fileName, List<string> lista, string tipo) { using (var w = WordprocessingDocument.Create(fileName, WordprocessingDocumentType.Document)) { var mp = w.AddMainDocumentPart(); var d = new DocumentFormat.OpenXml.Wordprocessing.Document(); var b = new Body(); var p = new DocumentFormat.OpenXml.Wordprocessing.Paragraph(); var r = new Run(); // Get

Set custom BackgroundColor of a Excel sheet cell using epplus c#

陌路散爱 提交于 2019-12-02 18:41:00
The problem: I am using EEPlus. I am stuck at applying a hex color code, e.g. #B7DEE8 , for a cell in my Excel sheet. I got the following (working) code: ws.Cells["A1:B1"].Style.Fill.PatternType = ExcelFillStyle.Solid; ws.Cells["A1:B1"].Style.Fill.BackgroundColor.SetColor(Color.Gray); But I need something like the following: ws.Cells["A1:B1"].Style.Fill.BackgroundColor.SetColor("#B7DEE8"); So my question is: is it possible to use hex color codes with EEPlus? If so, how can I do that? Yograj Gupta Try this Color colFromHex = System.Drawing.ColorTranslator.FromHtml("#B7DEE8"); ws.Cells["A1:B1"]

Replacing Content Controls in OpenXML

喜欢而已 提交于 2019-12-02 18:27:13
I need something as a placeholder. I at first looked to Content Control as a solution but I'm having some problems with it. I then looked into adding CustomXML to the .docx but turned away from that because of the i4i lawsuit. Then I decided I would just plain change the text of the Content Control through OpenXML SDK 2.0 but even if it's so marked the Content Control doesn't go away. I guess that it doesn't know that the text changed unless it happens inside word. I could perhaps just remove the CC and place text instead but I'm afraid of problems with format and styles it could bring and