[英]Microsoft.Office.Interop.Excel - *.csv file opening
I create *.csv
file, but when I open it using Microsoft.Office.Interop.Excel
, it's formatting is wrong, because of ignoring the delimiter ;
我创建了*.csv
文件,但是当我使用Microsoft.Office.Interop.Excel
打开它时,由于忽略了分隔符,因此格式设置错误;
. 。
excelWorkbook = excelApp.Workbooks.Open(workbookPath, 0,
false,5,"","", false, Excel.XlPlatform.xlWindows, "", true,
false, 0, true, false, false);
Which parameter of Workbooks.Open
should I change? 我应该更改Workbooks.Open
哪个参数?
Thank you for your suggestions. 谢谢你的建议。
This is how it should be: 这应该是这样的:
excelWorkbook = excelApp.Workbooks.Open(workbookPath, 0,
false,5,"","", false, Excel.XlPlatform.xlWindows, ";", true,
false, 0, true, false, false);
Interop Excel has a format to open CSV files. Interop Excel具有打开CSV文件的格式。
excel_app.Workbooks.Open(
txtFile.Text, // Filename
Type.Missing,
Type.Missing,
Excel.XlFileFormat.xlCSV, // Format
Type.Missing,
Type.Missing,
Type.Missing,
Type.Missing,
txtDelimiter.Text, // Delimiter
Type.Missing,
Type.Missing,
Type.Missing,
Type.Missing,
Type.Missing,
Type.Missing);
Format and Delimiter combo should be working in all cases. 在所有情况下,格式和定界符组合都应该起作用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.