简体   繁体   中英

opening a text file with excel opentext file using C#

I want to open a txt file with excel

which is like a "csv" file but instead of a comma, I want to use another character like start ( * ) after opening I would like to save it as an xlsx file how can I do that with the function Workbooks.opentext() ?

can you please give me a code example

this is the code I am using however I am getting an error since I am not sure how to use the openText method character

  xlApp = new Microsoft.Office.Interop.Excel.Application()
  var _wbs = xlApp.Workbooks;
 _wbs.OpenText(pathTemp,Microsoft.Office.Interop.Excel.oy //0, 26, 0, 0, 0, 0, 0, 0, 0, true, '^');
 _wbs[0].SaveAs(pathTemp + "Barak.xlsx");

每个http://msdn.microsoft.com/zh-CN/library/office/ff837097%28v=office.15%29.aspx

_wbs.OpenText(Path:=pathTemp,Datatype:=xlDelimited,Other:=True,Otherchar:="*");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM