我应该将csv文件转换为excel文件(.xls)。 此刻我使用了这段代码:
Excel.Application app = new Excel.Application();
Excel.Workbook wb = app.Workbooks.Open(fileOriginal, 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);
wb.SaveAs(fileExcel, Excel.XlFileFormat.xlOpenXMLWorkbook, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Excel.XlSaveAsAccessMode.xlExclusive, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
wb.Close();
app.Quit();
问题是它创建的文件只有一列。
我想改为在每个分号上创建已经分割的列的文件,而不必在点击数据后手动完成 - >列中的文字 - > ...
由于
答案 0 :(得分:0)
提及xlFileFormat和分隔符值
Microsoft.Office.Interop.Excel.Workbook wb = app.Workbooks.Open(fileOriginal, Type.Missing,
Type.Missing,Microsoft.Office.Interop.Excel.XlFileFormat.xlCSV, Type.Missing, Type.Missing,
Type.Missing, Type.Missing,";"
, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);