Hi All,
I am using excel interoperability in my code and i want to read the below delimited excel data.
MAS|201012211616360001|Q-0263014640218 067 0423|LIMITED TOO|SS SOLID POLO||6110202075|100% COTTON####|||Q086|CASUAL TOPS CUT SEWN S|CH|CHILDREN|CUT SEWN|CASUAL TOPS|0423|067|0263014640218|59024316||||||||||N|||1|EA|1|0|1|1|CM|0|KG
The code is as follow
string path = txtFile.Text;
DirectoryInfo dir = new DirectoryInfo(path);
FileInfo[] FileList = dir.GetFiles("*.*", SearchOption.AllDirectories);
foreach (FileInfo FI in FileList)
{
using (SqlConnection Connection = ConnectionManager.GetConnection())
{
Microsoft.Office.Interop.Excel.Application ExcelObj = new Microsoft.Office.Interop.Excel.Application();
Microsoft.Office.Interop.Excel.Workbook theWorkbook = ExcelObj.Workbooks.Open(FI.FullName, 0, true, 1, "","",false, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "|", true, false, 0, true,false, false);
Microsoft.Office.Interop.Excel.Sheets sheets = theWorkbook.Worksheets;
Microsoft.Office.Interop.Excel.Worksheet workSheet = (Microsoft.Office.Interop.Excel.Worksheet)sheets.get_Item(1);
int rowIndex = 1;
int colIndex1 = 1;
int index = 0;
a: while (((Microsoft.Office.Interop.Excel.Range)workSheet.Cells[rowIndex, colIndex1]).Value2 != null)
{
At this point the value2 is showing the entire row, its not delimiting based on "|"
I am going crazy...it was working fine somedays ago...I donno what's happening
Please help I am using Microsoft.Office.Interop.Excel 12.0