3

OpenXML-SDKとC#を使用して、行ではなく列ごとにExcelシートを読み取る方法はありますか?

私はすでにEPPlusパッケージを使用しようとしましたが、アプリケーションがEPPlusでサポートされていない「.xslm」ファイルも使用しているため、いくつかの問題に直面しました。したがって、列のデータを読み取るためのOpenXMLのソリューションが必要です。

誰かが例を持っているなら、それは助けになります。

ありがとうスリ

4

1 に答える 1

2
    WorksheetPart worksheetPart = (WorksheetPart)document.WorkbookPart.GetPartById(sheets.First().Id);


// Get the cells in the specified column and order them by row.
IEnumerable<Cell> cells = worksheetPart.Worksheet.Descendants<Cell()
.Where(c => string.Compare(GetColumnName(c.CellReference.Value),
columnName, true) == 0).OrderBy(r => GetRowIndex(r.CellReference));

foreach (var cell in cells)
{

}
于 2011-03-14T19:52:28.937 に答える