美文网首页
.NETCore中xls转换xlsx

.NETCore中xls转换xlsx

作者: 渣渣曦 | 来源:发表于2019-12-03 10:21 被阅读0次

1、创建项目

dotnet new console -o myApp
cd myApp

2、在https://www.nuget.org/packages中搜索转换库Spire.XLS结果如下:

image.png
3、执行命令
dotnet add package Spire.XLS --version 9.11.14

4、主程序Program.cs内容如下:

using System;
using Spire.Xls;

namespace myApp
{
    class Program
    {
        static void Main(string[] args)
        {
            // create a new excel document
            Workbook book = new Workbook();
            //load a document from file
            book.LoadFromFile("Input.xls");
            //Save the file to the version you want
            book.SaveToFile("Output.xlsx", ExcelVersion.Version2013);
        }
    }
}

5、编译release版本

dotnet build --configuration Release

相关文章

网友评论

      本文标题:.NETCore中xls转换xlsx

      本文链接:https://www.haomeiwen.com/subject/baaqgctx.html