using Microsoft.Office; .... xlsApp = new Excel.ApplicationClass(); xlsWBs = xlsApp.Workbooks; xlsWB = xlsWBs.Open(TempFileName,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing);
I tried to use the following parameters (according to a MSDN document at here) but no luck.
xlsWB = xlsWBs.Open(TempFileName,Type.Missing,Type.Missing,6,Type.Missing,Type.Missing,Type.Missing,Type.Missing,"|",Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing);
Then I found a trick: change the file ext from ".csv" to ".txt" then it will works. Why? Read the MSDN document that I mentioned above about the Format parameter carefully: "If Microsoft Excel opens a text file ...". See? A text file! :)
Thank you for sharing such a informative post...
ReplyDeletemobile application development in indore