Opening .dat (tab delimited file) in Excel, save as .xls

前端 未结 4 1602
无人及你
无人及你 2021-01-14 16:39

I am trying to open a .dat file in Excel, which is tab delimited, and then have it save out as a .xls file.

So far, I can read in the file and save it as the .xls fi

4条回答
  •  渐次进展
    2021-01-14 17:31

    I don't use C#, but I'm thinking you might need to use something like Workbooks.OpenText method detailed here: http://msdn.microsoft.com/en-us/library/bb223513%28v=office.12%29.aspx

    It allows you to specify delimiters, etc.

    Something like this:

    xlWorkBook = xlApp.Workbooks.OpenText (filename:="DATA.TXT", dataType:=xlDelimited, tab:=True);
    

    That's from the Excel 2007 Developer reference, but maybe there's a similar method in C#? Just a guess.

提交回复
热议问题