openxml

How to read metadata information from docx documents?

不打扰是莪最后的温柔 提交于 2019-11-29 15:11:19
问题 what I need to achieve is to have a word document template(docx), which will contain Title, Author name, Date, etc. This template then will be used by users to complete it. I need to create a c# program, that will take in the docx file and read all the information of interest(title, name, date, ..). So my questions are: How do I put the metadata into the template saying: this is Title, this is Date, this is Name, etc? (not programatically) How do I programmatically read that information? 回答1:

How to create .doc file or word processor in iOS application?

放肆的年华 提交于 2019-11-29 15:10:43
I am looking for word file processing in IOS application. I digging many things on google from that i found word file is based on OOXML . It`s possible for iOS to follow this format.Then please refer me if anyone have idea. Then i tried to found another way to changes styles of .doc file. and i found, we can perform such thing in UIWebView using JavaScripts on .html file. But still not get how to store this .html file in .doc. if anyone have idea regarding word-processor then guide me how it`s possible in objective C any help appreciated. Thanks, Try the libopc open source library, which

Is it possible to insert pieces of RTF text into a Word document (.docx) using OpenXml?

家住魔仙堡 提交于 2019-11-29 14:50:23
I'm developing a .NET C# app that needs to create a Word document, inserting fragments of RTF text which are stored in a database. Does anyone know if it is possible and how this is done using OpenXml (or COM interop)? I don't need to convert one complete RTF file into a Word document. I need to programatically create a Word document and add pieces of RTF text in different places in the word document using C#. You can import external content via the altChunk anchor. The altChunk anchor defines a place within a word document to insert external content such as RTF, HTML, XML, ... For more

How to get chart info from an Excel spreadsheet using Apache POI?

六月ゝ 毕业季﹏ 提交于 2019-11-29 14:45:35
Is it possible to extract chart information from an Office 2007 (xlsx / OpenXML) spreadsheet using Apache POI? I've managed to read in the spreadsheet and even get the part that refers to the chart but not sure how I can retrieve any info from this part e.g. Type of chart, chart data etc. XSSFWorkbook xwb = new XSSFWorkbook("charts_lines.xlsx"); XSSFSheet sheet = xwb.getSheetAt(0); I can also iterate through the package parts to retrieve the chart part, but I don't see how I then go on to retrieve any info about the chart? Note, I'm not interested in creating charts using POI, just read as

How to convert xls file to xlsx file using C#?

随声附和 提交于 2019-11-29 13:47:31
I was developing an application which read data from an excel file, but when I try to open it, an exception was thrown if the source file is saved with the xls format (File contains corrupted data error when opening Excel sheet with OpenXML). indeed when I save this file with the xlsx format it works fine. please help me to solve this problem. j1rjacob Use Free Spire.XLS dll available via NuGet . Sample: Workbook workbook = new Workbook(); workbook.LoadFromFile("Input.xls"); workbook.SaveToFile("Output.xlsx", ExcelVersion.Version2013); You cannot read xls files with OpenXML. The solution from

Create Merge Cells using OpenXML

天涯浪子 提交于 2019-11-29 13:15:38
Please consider this Excel: and it's XML: I want to create such this Excel that has multiple merged cells using OpenXML. How I can do this? thanks You can use the MergeCells and MergeCell classes to create the merged cells you require. The MergeCells class is the collection of merge cells ( <mergeCells count="3"> in your XML) and the MergeCell class represents each individual set of merged cells ( <mergeCell ref="xx:xx" /> in your XML). To populate data in the merged cells you need to add the value to the upper left most cell; any other values will be ignored. The following code will create a

OpenXML takes much longer than OLEDB to read rows from Excel sheet

倾然丶 夕夏残阳落幕 提交于 2019-11-29 12:48:06
When I used OLEDB, it takes only 2 - 3 seconds to read 3200 rows from an Excel Sheet. I changed to the OpenXML format and now it takes more than 1 minute to read 3200 rows from an Excel Sheet. Below is my code: public static DataTable ReadExcelFileDOM(string filename) { DataTable table; using (SpreadsheetDocument myDoc = SpreadsheetDocument.Open(filename, true)) { WorkbookPart workbookPart = myDoc.WorkbookPart; Sheet worksheet = workbookPart.Workbook.Descendants<Sheet>().First(); WorksheetPart worksheetPart = (WorksheetPart)(workbookPart.GetPartById(worksheet.Id)); SheetData sheetData =

Excel 2003 XML format - AutoFitWidth not working

南楼画角 提交于 2019-11-29 12:23:39
问题 I have a program that spits out an Excel workbook in Excel 2003 XML format. It works fine with one problem, I cannot get the column widths to set automatically. A snippet of what I produce: <Table > <Column ss:AutoFitWidth="1" ss:Width="2"/> <Row ss:AutoFitHeight="0" ss:Height="14.55"> <Cell ss:StyleID="s62"><Data ss:Type="String">Database</Data></Cell> This does not set the column to autofit. I have tried not setting width, I have tried many things and I am stuck. Thanks. 回答1: Only date and

Parsing OpenXML with multiple elements of the same name

可紊 提交于 2019-11-29 11:28:31
I have a data structure as such: <rootnode> <group> <id>1</id> <anothernode>first string</anothernode> <anothernode>second string</anothernode> </group> <group> <id>2</id> <anothernode>third string</anothernode> <anothernode>fourth string</anothernode> </group> </rootnode> And the following code: EXEC sp_xml_preparedocument @index OUTPUT, @XMLdoc SELECT * FROM OPENXML (@index, 'rootnode/group') WITH ( id int 'id', anothernode varchar(30) 'anothernode' ) which gives me the result id | anothernode ———————————————— 1 | first string 2 | third string How can I get it to show this result instead

OpenXML Sax method for exporting 100K+ rows to Excel fast

╄→尐↘猪︶ㄣ 提交于 2019-11-29 10:21:33
问题 I have been trying to improve the performance of the SAX method for writing to an xlsx. I know there is a limit of 1048576 rows in Excel. I have hit this limit only a few times. In most cases though I only write out about 125K to 250K rows (a large dataset). The code that I have tried doesn't seem to be as fast as it could be because of the many times it will write to the file. I would hope that there is some caching involved but it still seems like there is way too much disk access in the