openxml-sdk

open xml reading from excel file

不羁的心 提交于 2019-11-26 07:34:36
问题 I want to implement openXml sdk 2.5 into my project. I do everything in this link using DocumentFormat.OpenXml; using DocumentFormat.OpenXml.Packaging; using DocumentFormat.OpenXml.Spreadsheet; using System.IO.Packaging; static void Main(string[] args) { String fileName = @\"C:\\OPENXML\\BigData.xlsx\"; // Comment one of the following lines to test the method separately. ReadExcelFileDOM(fileName); // DOM //ReadExcelFileSAX(fileName); // SAX } // The DOM approach. // Note that the code below

open xml excel read cell value

怎甘沉沦 提交于 2019-11-26 06:39:15
问题 I am using the Open XML SDK to open an Excel xlsx file and I try to read the cellvalue on position A1 in each sheet. I use the following code: using (SpreadsheetDocument spreadsheetDocument = SpreadsheetDocument.Open(openFileDialog1.FileName, false)) { var sheets = spreadsheetDocument.WorkbookPart.Workbook.Descendants<Sheet>(); foreach (Sheet sheet in sheets) { WorksheetPart worksheetPart = (WorksheetPart)spreadsheetDocument.WorkbookPart.GetPartById(sheet.Id); Worksheet worksheet =