は試行されており、実際の結果は得られません。位置(LinqまたはXPATH)でXMLノードを選択する方法
<?xml version="1.0"?>
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:html="http://www.w3.org/TR/REC-html40">
<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
...
</DocumentProperties>
<OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">
...
</OfficeDocumentSettings>
<ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
...
</ExcelWorkbook>
<Styles>
...
</Styles>
<Worksheet ss:Name="Report">
<Table ss:ExpandedColumnCount="41" ss:ExpandedRowCount="4082" x:FullColumns="1"
x:FullRows="1" ss:DefaultColumnWidth="60" ss:DefaultRowHeight="15">
<Row>
<Cell ss:StyleID="s62"><Data ss:Type="String">Cell_1</Data></Cell>
<Cell ss:StyleID="s62"><Data ss:Type="String">Cell_2</Data></Cell>
...
<Cell ss:StyleID="s62"><Data ss:Type="String">Cell_40_Active</Data></Cell>
</Row>
<Row>
<Cell ss:StyleID="s62"><Data ss:Type="String">Cell_1</Data></Cell>
<Cell ss:StyleID="s62"><Data ss:Type="String">Cell_2</Data></Cell>
...
<Cell ss:StyleID="s62"><Data ss:Type="String">Cell_40_Active</Data></Cell>
</Row>
</Table>
<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
...
</WorksheetOptions>
</Worksheet>
</Workbook>
目標は、唯一これらの行を選択することで、行の40-セル(ID)内の「Cell_40_Active」が含ま:考える
は、この構造のように、ExcelのXMLです。以下のように:...
XmlDocument doc = new XmlDocument();
doc.Load(file);
XmlElement root = doc.DocumentElement;
// does return all Row-elements >> working
XmlNodeList nodes = root.GetElementsByTagName("Row");
//does not return any element (0)
XmlNodeList nodes = root.SelectNodes("/Worksheet/Row/Cell[40]='Cell_40_Active'");
はどのようにこれは、細胞[40] .Data.InnerText = "Cell_40_Active" 行うことができますか?似たようなものを見つけられなかった... 何かヒント?どうもありがとうございました。
それはトリックでした...ありがとう、おい! – SiL3NC3