有没有办法使用OpenXML-SDK & C#逐列而不是以行的方式读取excel表格?
我已经尝试过使用EPPlus包,但遇到了一些问题,因为我的应用程序也使用了EPPlus不支持的".xslm“文件。因此,我需要一个在OpenXML中读取列数据的解决方案。
如果任何人有一个例子,那将会有所帮助。
感谢Sri
发布于 2011-03-15 03:52:29
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)
{
}https://stackoverflow.com/questions/4715690
复制相似问题