Hi Laurence, Excel excel = new Excel().Open(“c:\importform.xls”); Response.Write(str1 + “,” + str2 + “,” + str3 + “,” + str4 + “,” + str5 + “
I used the following code to read the excel file and extract the content in each cell. But the data is not correct:
int currentRow = 0;
do
{
string str1 = excel.Worksheets[0].Cells[currentRow,1].StringValue.ToString().Trim();
string str2 = excel.Worksheets[0].Cells[currentRow,0].StringValue.ToString().Trim();
string str3 = excel.Worksheets[0].Cells[currentRow,2].StringValue.ToString().Trim();
string str4 = excel.Worksheets[0].Cells[currentRow,3].StringValue.ToString().Trim();
string str5 = excel.Worksheets[0].Cells[currentRow,4].StringValue.ToString().Trim();
”);
currentRow = currentRow + 1;
}
while(excel.Worksheets[0].Cells[currentRow,0].StringValue.ToString().Trim() != “”);
PP1,A01a,MO,1,200
PP1,A01a,MO,2,201
PP1,A01a,MO,3,202
PP1,A01a,MO,4,203
PP1,A01a,MO,5,204
PP1,A01a,MO,6,205
PP1,A01a,MO,7,206
PP1,A01a,MO,8,207
PP1,A01a,MO,9,208
PP1,A01a,MO,10,209
PP1,A01a,MO,11,210
PP1,A01a,MO,12,211
But the result that extracted by Aspose.Excel is:
PP1,A01a,MO,1,200
PP1,A01a,m95d4aowftfUsZ,2,201
PP1,A01a,MO,3,202
PP1,A01a,MO,4,203
PP1,A01a,MO,5,204
PP1,A01a,MO,6,205
PP1,A01a,MO,7,206
PP1,A01a,MO,8,207
PP1,A01a,MO,9,208
PP1,A01a,MO,10,209
PP1,A01a,MO,11,210
PP1,A01a,MO,12,211
Did you have such problem?
Thanks and Regards,
Johnson