c# - OpenXml WorksheetParts.First() is not always the 1st sheet MS Excel shows -



c# - OpenXml WorksheetParts.First() is not always the 1st sheet MS Excel shows -

i have xlsx files when viewed in excel have multiple sheets. however, of files using snippet below have worksheetpart.first 2nd or 3rd worksheet when viewed in excel. i think because sheets re-arranged in excel @ 1 point.

q: how utilize openxml read sheets in "view" order ms-excel shows them in, versus can out of order via openxml? note: can't utilize sheet name workaround.

using (var document = spreadsheetdocument.open(".\test.xlsx", false)) { var workbookpart = document.workbookpart; var worksheetpart = workbookpart.worksheetparts.first(); // worksheetpart not first worksheet excel shows }

i guess worksheet parts not in order. should in order though workbook.sheets property (you can search name here). can correlate sheet worksheetpart through it's id, see here example.

c# openxml openxml-sdk

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -