public static Boolean GetSheetDataTable(String ExcelPath,Int32 RowStartIndex, Int32 ColumnStartIndex, Int32 SheetIndex, out List<List<String>> ResultTable)
{
Boolean BRetFlag = false;
ResultTable = new List<List<String>>();
CExcelHelper InfoTabelExcel = new CExcelHelper(ExcelPath);
InfoTabelExcel.ChangeCurrentWorkSheet(SheetIndex);
try
{
Int32 SpaceRowCount = 0;
for (Int32 RowIndex = RowStartIndex; RowIndex < 65000; RowIndex++)
{
if (SpaceRowCount >= 10) { break; }
String Code = String.Empty;
InfoTabelExcel.GetCells(RowIndex, ColumnStartIndex, out Code);
if (Code == String.Empty)
{ SpaceRowCount++; continue; }
else
{
SpaceRowCount = 0;
List<String> RowInfoData = new List<String>();
RowInfoData.Add(Code);
String Name = String.Empty;
for (Int32 ColumnIndex = ColumnStartIndex + 1; ColumnIndex < 65000; ColumnIndex++)
{
InfoTabelExcel.GetCells(RowIndex, ColumnIndex, out Name);
if (SpaceRowCount >= 10) { break; }
if (Name == String.Empty)
{
SpaceRowCount++;
continue;
}
SpaceRowCount = 1;
RowInfoData.Add(Name);
}
ResultTable.Add(RowInfoData);
SpaceRowCount = 0;
}
}
BRetFlag = true;
}
catch (Exception ex)
{
throw ex;
}
finally
{
InfoTabelExcel.KillExcelProcess();
}
return BRetFlag;
}
{
Boolean BRetFlag = false;
ResultTable = new List<List<String>>();
CExcelHelper InfoTabelExcel = new CExcelHelper(ExcelPath);
InfoTabelExcel.ChangeCurrentWorkSheet(SheetIndex);
try
{
Int32 SpaceRowCount = 0;
for (Int32 RowIndex = RowStartIndex; RowIndex < 65000; RowIndex++)
{
if (SpaceRowCount >= 10) { break; }
String Code = String.Empty;
InfoTabelExcel.GetCells(RowIndex, ColumnStartIndex, out Code);
if (Code == String.Empty)
{ SpaceRowCount++; continue; }
else
{
SpaceRowCount = 0;
List<String> RowInfoData = new List<String>();
RowInfoData.Add(Code);
String Name = String.Empty;
for (Int32 ColumnIndex = ColumnStartIndex + 1; ColumnIndex < 65000; ColumnIndex++)
{
InfoTabelExcel.GetCells(RowIndex, ColumnIndex, out Name);
if (SpaceRowCount >= 10) { break; }
if (Name == String.Empty)
{
SpaceRowCount++;
continue;
}
SpaceRowCount = 1;
RowInfoData.Add(Name);
}
ResultTable.Add(RowInfoData);
SpaceRowCount = 0;
}
}
BRetFlag = true;
}
catch (Exception ex)
{
throw ex;
}
finally
{
InfoTabelExcel.KillExcelProcess();
}
return BRetFlag;
}