openxml

OpenXml: Worksheet Child Elements change in ordering results in a corrupt file

余生颓废 提交于 2019-11-30 04:03:58
问题 I am trying to use openxml to produce automated excel files. One problem I am facing is to accomodate my object model with open xml object model for excel. I have to come to a point where I realise that the order in which I append the child elements for a worksheet matters. For Example: workSheet.Append(sheetViews); workSheet.Append(columns); workSheet.Append(sheetData); workSheet.Append(mergeCells); workSheet.Append(drawing); the above ordering doesnot give any error. But the following:

How do I convert a .docx to html using asp.net?

空扰寡人 提交于 2019-11-30 04:02:07
Word 2007 saves its documents in .docx format which is really a zip file with a bunch of stuff in it including an xml file with the document. I want to be able to take a .docx file and drop it into a folder in my asp.net web app and have the code open the .docx file and render the (xml part of the) document as a web page. I've been searching the web for more information on this but so far haven't found much. My questions are: Would you (a) use XSLT to transform the XML to HTML, or (b) use xml manipulation libraries in .net (such as XDocument and XElement in 3.5) to convert to HTML or (c) other

Replace Text in Word document using Open Xml

拥有回忆 提交于 2019-11-30 03:44:13
I have created a docx file from a word template, now I am accessing the copied docx file and want to replace certain text with some other data. I am unable to get the hint as to how to access the text from the doument main part? Any help would be appreciable. Below is my code till now. private void CreateSampleWordDocument() { //string sourceFile = Path.Combine("D:\\GeneralLetter.dot"); //string destinationFile = Path.Combine("D:\\New.doc"); string sourceFile = Path.Combine("D:\\GeneralWelcomeLetter.docx"); string destinationFile = Path.Combine("D:\\New.docx"); try { // Create a copy of the

OpenXML libraries (alternatives to ClosedXML) [closed]

本小妞迷上赌 提交于 2019-11-30 03:39:06
What are some libraries that extend OpenXML (or add a kind of abstraction layer to OpenXML) similar to ClosedXML? I'm looking for a commercial or freeware tool with at least 1.0 version. Thank you in advance. Berat Bilgin Open-Source: Have you looked at EPPlus ? Slogan: Create advanced Excel 2007/2010 spreadsheets on the server. License: GNU Library General Public License (LGPL). I've been evaluating EPPlus, ClosedXML, and SpreadsheetLight over the past week. All three are really great libraries that make working with the extremely convoluted OpenXML a breeze. I've decided to go with EPPlus

How to group rows/columns in EPPlus

帅比萌擦擦* 提交于 2019-11-30 03:09:01
问题 Is there a way to achieve this in EPPlus? Only thing I could find on the internet is grouping specific data for example: AAA ---> AAA 5 occurrences AAA BBB 2 occurences BBB BBB AAA AAA AAA but not visually like in the screenshots 回答1: Looks like you want to do Row and Columns outlines that are collapsed. This should demonstrate how to do that: [TestMethod] public void Row_Col_Grouping_Test() { //http://stackoverflow.com/questions/32760210/how-to-group-rows-columns-in-epplus //Throw in some

Open XML - How to add a watermark to a docx document

旧时模样 提交于 2019-11-30 02:27:50
问题 I'm trying to take an existing document and if a header doesn't exist, create one, and then add a watermark to the header that says "DRAFT" diagonally. I've followed an example posted here and I've gotten the code to the point where it will add the watermark if the header already exists. The current issue is when I add a new header, add the reference to the document, and then add the watermark to the header, the document becomes corrupt and can no longer open in Word 2010. To test I've been

Reading dates from OpenXml Excel files

拜拜、爱过 提交于 2019-11-30 02:24:31
I'm trying to read data from the .xlsx files using SharpZipLib to unpack it (in memory) and reading the inner xml files. Everything is fine but recognizing the dates - they're stored in julean format and I need to somehow recognize if a number is a date or only a number. In another topic (unfortunately it died and I need quick answer) I got to know some things from Mark Baker, but it's still not enough... "Excel stores dates as a float value... the integer part being the number of days since 1/1/1900 (or 1/1/1904 depending on which calendar is being used), the fractional part being the

C# OPEN XML: empty cells are getting skipped while getting data from EXCEL to DATATABLE

落爺英雄遲暮 提交于 2019-11-30 01:28:40
问题 Task Import data from excel to DataTable Problem The cell that doesnot contain any data are getting skipped and the very next cell that has data in the row is used as the value of the empty colum. E.g A1 is empty A2 has a value Tom then while importing the data A1 get the value of A2 and A2 remains empty To make it very clear I am providing some screen shots below This is the excel data This is the DataTable after importing the data from excel Code public class ImportExcelOpenXml { public

OpenXML add new row to existing Excel file [closed]

微笑、不失礼 提交于 2019-11-29 17:27:00
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 years ago . I've got lots of XLSX files and I need to append a new row after the last one in the file. I'm using OpenXML and so far I know how to open/create spreadsheet, but my search for adding new rows to existing files returned nothing. Any ideas ? 回答1: If all you need to do is add a

How to extract plain text from a DOCX file using the new OOXML support in Apache POI 3.5?

*爱你&永不变心* 提交于 2019-11-29 17:24:33
问题 On September 28, 2009 the Apache POI project released version 3.5 which officially supports the OOXML formats introduced in Office 2007, like DOCX and XLSX. Please provide a code sample for extracting a DOCX file's content in plain text, ignoring any styles or formatting. I am asking this because I have been unable to find any Apache POI examples covering the new OOXML support. 回答1: This worked for me. Make sure you add the required jars (upgrade xmlbeans, etc.) public String extractText