Hello,
I'm trying to load a xlsx file into an XmlDocument and want to read some values within that document.
What I did:
Extract the Xlsx file to a temporary folder and loaded the 'xl\worksheets\ sheet1.xml' into the xmlDocument.
But after that it looks almost impossible to get data out of it.
This is my code:
Also tried other Node's and NodeLists but it would not give me the data I want. And I need the data inside sheetData/row..
Here is a little copy of the xml...
Hope someone can help a little hand...
Regards,
Paul
I'm trying to load a xlsx file into an XmlDocument and want to read some values within that document.
What I did:
Extract the Xlsx file to a temporary folder and loaded the 'xl\worksheets\ sheet1.xml' into the xmlDocument.
But after that it looks almost impossible to get data out of it.
This is my code:
Code:
xml.Load(TempFolder + "xl\\worksheets\\sheet1.xml");
XmlNodeList elemList = xml.SelectNodes("/worksheet/sheetData");
for (int i = 0; i < elemList.Count; i++)
{
string bla = elemList[i].Name;
}
Here is a little copy of the xml...
Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<worksheet xml:space="preserve" xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
<sheetPr>
<outlinePr summaryBelow="1" summaryRight="1"/>
</sheetPr>
<dimension ref="A1:Q1273"/>
<sheetViews>
<sheetView tabSelected="1" workbookViewId="0" showGridLines="true">
<selection activeCell="Q3" sqref="Q3:Q1273"/>
</sheetView>
</sheetViews>
<sheetFormatPr defaultRowHeight="12.75" outlineLevelRow="0" outlineLevelCol="0"/>
<cols>
<col min="1" max="1" width="20" customWidth="true" style="0"/>
<col min="2" max="2" width="20" customWidth="true" style="0"/>
<col min="3" max="3" width="50" customWidth="true" style="0"/>
<col min="4" max="4" width="12" customWidth="true" style="0"/>
<col min="5" max="5" width="12" customWidth="true" style="0"/>
<col min="6" max="6" width="12" customWidth="true" style="0"/>
<col min="7" max="7" width="12" customWidth="true" style="0"/>
<col min="8" max="8" width="12" customWidth="true" style="0"/>
<col min="9" max="9" width="12" customWidth="true" style="0"/>
<col min="10" max="10" width="12" customWidth="true" style="0"/>
<col min="11" max="11" width="12" customWidth="true" style="0"/>
<col min="12" max="12" width="12" customWidth="true" style="0"/>
<col min="13" max="13" width="12" customWidth="true" style="0"/>
<col min="14" max="14" width="12" customWidth="true" style="0"/>
<col min="15" max="15" width="12" customWidth="true" style="0"/>
<col min="16" max="16" width="12" customWidth="true" style="0"/>
<col min="17" max="17" width="12" customWidth="true" style="0"/>
</cols>
<sheetData>
<row r="1" spans="1:17">
<c r="A1" t="s">
<v>0</v>
</c>
<c r="K1" s="1">
<v>41201</v>
</c>
</row>
<row r="2" spans="1:17">
<c r="A2" t="s">
<v>1</v>
</c>
<c r="B2" t="s">
<v>2</v>
</c>
<c r="C2" t="s">
<v>3</v>
</c>
<c r="D2" t="s">
<v>4</v>
</c>
<c r="E2" s="1">
<v>41208</v>
</c>
<c r="F2" s="1">
<v>41215</v>
</c>
<c r="G2" s="1">
<v>41222</v>
</c>
<c r="H2" s="1">
<v>41229</v>
</c>
<c r="I2" s="1">
<v>41236</v>
</c>
<c r="J2" s="1">
<v>41243</v>
</c>
<c r="K2" s="1">
<v>41250</v>
</c>
<c r="L2" s="1">
<v>41257</v>
</c>
<c r="M2" s="1">
<v>41264</v>
</c>
<c r="N2" s="1">
<v>41271</v>
</c>
<c r="O2" s="1">
<v>41278</v>
</c>
<c r="P2" s="1">
<v>41285</v>
</c>
<c r="Q2" s="1">
<v>41292</v>
</c>
</row>
<row r="3" spans="1:17">
<c r="A3">
<v>1111000001</v>
</c>
<c r="B3">
<v>100010</v>
</c>
<c r="C3" t="s">
<v>5</v>
</c>
<c r="D3" s="2">
<v>0</v>
</c>
<c r="E3" s="2">
<v>0</v>
</c>
<c r="F3" s="2">
<v>0</v>
</c>
<c r="G3" s="2">
<v>0</v>
</c>
<c r="H3" s="2">
<v>0</v>
</c>
<c r="I3" s="2">
<v>0</v>
</c>
<c r="J3" s="2">
<v>0</v>
</c>
<c r="K3" s="2">
<v>0</v>
</c>
<c r="L3" s="2">
<v>0</v>
</c>
<c r="M3" s="2">
<v>0</v>
</c>
<c r="N3" s="2">
<v>0</v>
</c>
<c r="O3" s="2">
<v>0</v>
</c>
<c r="P3" s="2">
<v>0</v>
</c>
<c r="Q3" s="2">
<v>0</v>
</c>
</row>
<row r="4" spans="1:17">
<c r="A4">
<v>1111000002</v>
</c>
<c r="B4">
<v>100011</v>
</c>
<c r="C4" t="s">
<v>6</v>
</c>
<c r="D4" s="2">
<v>0</v>
</c>
<c r="E4" s="2">
<v>0</v>
</c>
<c r="F4" s="2">
<v>0</v>
</c>
<c r="G4" s="2">
<v>0</v>
</c>
<c r="H4" s="2">
<v>0</v>
</c>
<c r="I4" s="2">
<v>0</v>
</c>
<c r="J4" s="2">
<v>0</v>
</c>
<c r="K4" s="2">
<v>0</v>
</c>
<c r="L4" s="2">
<v>0</v>
</c>
<c r="M4" s="2">
<v>0</v>
</c>
<c r="N4" s="2">
<v>0</v>
</c>
<c r="O4" s="2">
<v>0</v>
</c>
<c r="P4" s="2">
<v>0</v>
</c>
<c r="Q4" s="2">
<v>0</v>
</c>
</row>
</sheetData>
<sheetProtection sheet="false" objects="false" scenarios="false" formatCells="false" formatColumns="false" formatRows="false" insertColumns="false" insertRows="false" insertHyperlinks="false" deleteColumns="false" deleteRows="false" selectLockedCells="false" sort="false" autoFilter="false" pivotTables="false" selectUnlockedCells="false"/>
<autoFilter ref="A2:Q1273"/>
<printOptions gridLines="false" gridLinesSet="true"/>
<pageMargins left="0.7" right="0.7" top="0.75" bottom="0.75" header="0.3" footer="0.3"/>
<pageSetup paperSize="1" orientation="default" scale="100" fitToHeight="1" fitToWidth="1"/>
<headerFooter differentOddEven="false" differentFirst="false" scaleWithDoc="true" alignWithMargins="true">
<oddHeader></oddHeader>
<oddFooter></oddFooter>
<evenHeader></evenHeader>
<evenFooter></evenFooter>
<firstHeader></firstHeader>
<firstFooter></firstFooter>
</headerFooter>
</worksheet>
Regards,
Paul