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

前端 未结 4 1607
无人及你
无人及你 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:26

    This sould work:

    using Excel = Microsoft.Office.Interop.Excel;
    using Microsoft.Office;
    using Microsoft.Office.Core;
    
            Excel.Application xlApp;
            Excel.Workbook xlWorkBook;
            Excel.Worksheet xlWorkSheet;
            object misValue = System.Reflection.Missing.Value;
            xlApp = new Excel.Application();
            xlApp.Workbooks.OpenText(@"c:\data.txt", Microsoft.Office.Interop.Excel.XlTextParsingType.xlDelimited);
            xlApp.Visible = true;
    

提交回复
热议问题