openxml

OpenXML 2 SDK - Word document - Create bulleted list programmatically

£可爱£侵袭症+ 提交于 2019-12-02 16:23:05
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? 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 every item in the list you want to create, you add a new paragraph and assign the ID of the list you want to

Add a Caption to a Table or Figure in OpenXml

左心房为你撑大大i 提交于 2019-12-02 16:18:23
问题 I'm trying to create this structure in OpenXml: <P> <Table /> <Caption>Table 1 - Some Text 1 </Caption> <Picture /> <Caption>Figure 1 - Some Text 2 </Caption> </P> In terms of code I have: var currentLine = new Paragraph(); currentLine.AppendChild(new Run(elem)); -> Where the elem is Table ... currentLine.AppendChild(new Run(elem2)); -> Where the elem2 is Drawing So I only miss the way to add captions, the same captions that I can do in MS Word References-> Insert Caption. Some information

TextBox positioning in OpenXML

早过忘川 提交于 2019-12-02 14:51:23
问题 I am new in OpenXML. I am trying to create the word(.docx) file having simple text and images in it using openxml. I have already mentioned all this in my earlier post: My Earlier post I am using this code 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());

EPPlus error reading file

两盒软妹~` 提交于 2019-12-02 13:35:30
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 The problem is in the ZIP file reader ( ZipInputStream ). You need to add the encodings like windows-1252 manually: dotnet add package

How to rotate text in Excel spreadsheet cell using OpenXML and C#

荒凉一梦 提交于 2019-12-02 13:06:54
问题 I'm trying to finish little application which is creating MS Excel spreadsheet filled with some data taken from a database. I got stucked with few things. One of these is how to rotate a text in a spreadsheet cell. I was trying to do it in that way: SpreadsheetStyle style = SpreadsheetReader.GetDefaultStyle(spreadSheet); style.AddAlignment(new Alignment() { TextRotation = 90 }); but of course it didn't work. I'm using WorksheetWriter class to build excel doc. I couldn't find anything helpful

Word VSTO - Why paraId is sometimes missing

旧城冷巷雨未停 提交于 2019-12-02 12:15:54
I'm retrieving paragraph stylenames from openXML and using paraID property to get the right one. During testing i noticed that depending on the word document the attribute might not be present on any of the paragraphs. I do know that this is a internal runtime paragraph id for Word. So the question is: What generates the paraId properties on the paragraphs, can't seem to figure this out. ps. I don't want to use get_style() since that is waay too slooooow... edit: added code example This is in some documents "0" and in some documents a valid hex id string sParaId = range.Paragraphs.First.ParaID

Does a good wrapper class and/or library for open xml Excel editing exist?

冷暖自知 提交于 2019-12-02 11:53:29
问题 I'm looking for a nice library for editing and/or generating Excel documents on our Windows server. I feel that the open xml sdk is probably the way to go, but to me the learning curve seems steep and our dev time is limited. I think that it just shouldn't be that difficult to edit an Excel document. I'm ready to reinvent the wheel, but thought it would be worthwhile to ask first whether there is a good project/library out there that wraps open xml and makes interacting with Excel easier. In

C# using OpenXML to replace CustomXml not working

牧云@^-^@ 提交于 2019-12-02 10:54:36
问题 The following is the code I'm using to create a new word document from an existing document. What does work is that it successfully reads the template document (templateName) and it is able to create the 'customXML' string from the model class. But what is not working is the customXML information (address, city, state, zip,...) is not replacing the empty tags. I pulled this code from an older .NET web application and I'm using it in MVC 4.5 with OpenXml 2.5. The Older version of the code

TextBox positioning in OpenXML

筅森魡賤 提交于 2019-12-02 08:42:04
I am new in OpenXML. I am trying to create the word(.docx) file having simple text and images in it using openxml. I have already mentioned all this in my earlier post: My Earlier post I am using this code 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 = body.AppendChild(new Paragraph()); ParagraphProperties oParagraphProperties = para

How to save (and open) an Open XML document as Excel file?

浪子不回头ぞ 提交于 2019-12-02 08:25:30
I have an Open XML document. I would like to know how to save it as an .xlsx file. I tried opening Excel software and did Developer -> Import but that opened my XML file as Excel - but it literally opened the XML file as an XML document and did not open it as an Excel version of an Open XML document. This is the Open XML document I have: <?xml version="1.0"?> <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:html="http:/