当我将 Spreadsheet Light v3.5.0 与 DocumentFormat.OpenXml v3.0.0 结合使用时,为什么会出现 System.InvalidProgramException?

问题描述 投票:0回答:1

当我尝试将最新版本的 DocumentFormat.OpenXml 与 Spreadsheet Light 一起使用时,出现以下异常。

我已将代码精简为这样。调用 SLDocument 构造函数时会出现异常。

using SpreadsheetLight;

var template = new SLDocument();

这是我的项目文件。

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net7.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="DocumentFormat.OpenXml" Version="3.0.0" />
    <PackageReference Include="SpreadsheetLight" Version="3.5.0" />
  </ItemGroup>

</Project>

这适用于 DocumentFormat.OpenXml v2.20.0,但升级后会失败。

excel openxml spreadsheetlight
1个回答
0
投票

它是 DocumentFormat.OpenXml 版本。 Spreadsheet Light 的工作原理 >=2.11.3 我发现 DocumentFormat.OpenXml 版本 2.20.0 效果最好

© www.soinside.com 2019 - 2024. All rights reserved.