public void ParseExcelFile(FileInfo file)
{
using (SLDocument sl = new SLDocument())
{
FileStream fs = new FileStream(file.FullName, FileMode.Open);
MemoryStream msFirstPass = new MemoryStream();
SLDocument sheet1 = new SLDocument(fs, "Sheet1");
// There is no way that I can see to get the Rows
foreach(var row in sheet1.Rows)
{
foreach(SLCell c in row)
{
// There is no way that I can see to get the Column Index
switch(c.Column )
{
case 1:
//Handle data if cell is Column 1
break;
case 2:
//Handle data if cell is Column 2
break;
case 3:
//Handle data if cell is Column 3
break;
}
}
}
}
}//func
Используя инструмент SpreadSheetLight, я не могу найти, как читать строки файла электронной таблицы. В частности, Лист 1.
У меня есть две проблемы:
[list] [*]Нет никакого способа которые я вижу, чтобы получить строки [*]Я не вижу способа получить индекс столбца Вот мой код
[code]public void ParseExcelFile(FileInfo file) { using (SLDocument sl = new SLDocument()) { FileStream fs = new FileStream(file.FullName, FileMode.Open);
MemoryStream msFirstPass = new MemoryStream(); SLDocument sheet1 = new SLDocument(fs, "Sheet1");
// There is no way that I can see to get the Rows foreach(var row in sheet1.Rows) { foreach(SLCell c in row) { // There is no way that I can see to get the Column Index switch(c.Column ) { case 1: //Handle data if cell is Column 1 break; case 2: //Handle data if cell is Column 2 break; case 3: //Handle data if cell is Column 3 break; } } }