Spreadsheet Light v3.4 需要 OpenXML 2.5,但不推荐使用智能标签

Spreadsheet Light v3.4 asks for OpenXML 2.5 but smarttags are deprecated

我使用的是 C# 和 Spreadsheet Light 最新版本 3.4。 此版本需要 OPEN Xml 2.5(不推荐使用哪些智能标签)。

我正在尝试使用以下代码创建一个基本的 XLS:

SLDocument sl = new SLDocument();
 sl.SetCellValue(1, 1, "SURNAME");
 sl.SaveAs("HelloWorld.xlsx");

` 问题是版本 3.4 要求 openxml 2.5,其中不推荐使用 smarttags,因此它会产生以下错误。

{"Could not load type 'DocumentFormat.OpenXml.Spreadsheet.SmartTags' from assembly 'DocumentFormat.OpenXml, Version=2.5.5631.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.":"DocumentFormat.OpenXml.Spreadsheet.SmartTags"}

如何克服上述问题?

问题是在SpreadSheetLight官网上,没有下载最新版本3.4.9的选项。您只能通过 nuget 包管理器下载它。安装 3.4.9 解决了这个问题。