openxml

How to distinguish inline numbers from OLE Automation date numbers in OpenXML SpreadSheet?

我怕爱的太早我们不能终老 提交于 2019-12-18 17:36:52
问题 I have to consume some xlsx documents. I've read Reading a date from xlsx using open xml sdk and http://www.dotnetperls.com/fromoadate. Most of my columns are texts (shared strings), but there are some numbers (integer numbers), and I have also some dates and date-times. I'm using OpenXML SDK 2.5. My problem is that I don't know how to distinguish the actual numbers from the dates. Both of them has DataType of null , and the textual number representation is in the Text property of the cell.

Creating custom column widths in OpenXML (excel)

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-18 15:28:09
问题 I am new to OpenXML (v. 2.5), and I can create rows and cells, but I need to be able to set the column width and I can not do that correctly for some reason. Without this code: Columns cols = new Columns(); Column c1 = new Column() { CustomWidth = true, Width = 20 }; cols.Append(c1); wspart.Worksheet.Append(cols); The program runs and generates an excel file fine. The code below complies and runs, but leaves me with a corrupt excel document. What am I doing wrong when I try to add columns?

Inserting new rows and moving exsisting ones with OpenXML SDK 2.0

北慕城南 提交于 2019-12-18 12:37:26
问题 I'm using OpenXML SDK 2.0 to add data to the spreadsheet template but I ran into a problem (since I've been using OpenXML for a day that's not so hard to believe). I can't figure out how to add new rows while pushing all the rows that are below the new ones down. Here is the spreadsheet template I'm using. To be more precise, what I want to achieve is to move those slate colored rows to the bottom while adding data to the white colored rows. The code I'm currently using is identical to the

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

旧巷老猫 提交于 2019-12-18 11:33:47
问题 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

C# EPPlus OpenXML count rows

亡梦爱人 提交于 2019-12-18 11:08:03
问题 With EPPlus and OpenXML does anyone know the syntax on how to count the rows? Say my worksheet is called "worksheet" int numberRows = worksheet.rows.count() ? or worksheet.rows.dimension I'm certainly interested in the answer, but how to find the answer would be cool to, like "Go to definition" and look for this or that, etc. 回答1: With a worksheet object called worksheet , worksheet.Dimension.Start.Row and worksheet.Dimension.End.Row should give you the information you need. worksheet

Having trouble reading excel file with the OpenXML sdk

Deadly 提交于 2019-12-18 09:06:36
问题 I have a function that reads from an excel file and stores the results in a DataSet . I have another function that writes to an excel file. When I try to read from a regular human-generated excel file, the excel reading function returns a blank DataSet , but when I read from the excel file generated by the writing function, it works perfectly fine. The function then will not work on a regular generated excel file, even when I just copy and paste the contents of the function generated excel

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

杀马特。学长 韩版系。学妹 提交于 2019-12-18 08:56:19
问题 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

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

谁说胖子不能爱 提交于 2019-12-18 08:52:53
问题 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#. 回答1: You can import external content via the altChunk anchor. The altChunk anchor

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

落爺英雄遲暮 提交于 2019-12-18 07:18:34
问题 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();

Convert XLSM to XLSX

ε祈祈猫儿з 提交于 2019-12-18 06:57:30
问题 I'm using the EPPLUS library to read data from Excel to create another file. Unfortunately it does not support the .XLSM extension file. Is there a nice way to convert .XLSM files to .XLSX file for the purpose of reading the file with EPPLUS? (using EPPLUS for reading would be nice because all my code is already written using it :) ) 回答1: In order to do this you will need to use the Open XML SDK 2.0. Below is a snippet of code that worked for me when I tried it: byte[] byteArray = File