C# convert csv to xls (using existing csv file)

前端 未结 3 957
自闭症患者
自闭症患者 2020-12-24 14:49

i believe here are lot a discussion with this matter. but i read all post and try but it never work with c#. my goal is simple that i have existing csv file. just want conve

3条回答
  •  滥情空心
    2020-12-24 15:32

    At the top of your file insert the following line:

    using Microsoft.Office.Interop.Excel;
    

    This will include the namespace needed to use the XlFileFormat and XlSaveAsAccessMode classes. If this does not work you may need to add a reference to this DLL to your project as well.

    The Close method takes in the following arguments:

    1. SaveChanges
    2. Filename
    3. RouteWorkbook

    The documentation for that is here.

    Hope that helps.

提交回复
热议问题