c# - 使用 ASP.Net Core 2.0 使用 NuGet NPOI 进行 Excel 解析

标签 c# excel azure nuget-package asp.net-core-2.0

我正在使用 Visual Studio 2017 最新版本和 Asp.Net Core 2.0 SDK 创建一个 Web Api,需要读取之前上传到 Azure 文件存储中的 Excel。现在我可以下载 Excel 文件,但我需要读取并解析 Excel 工作表中的各个单元格。为了实现这一目标,我目前正在尝试使用包管理器 NPOI (Nuget)。

下面是我为此使用的命令:

Pm> Install-Package NPOI -Version 2.3.0

但是运行后我收到以下错误:

Unable to find Package from NuGet

注意,我已经检查了我的“Project.csproj”文件以添加适当的引用,但即使添加后它也不起作用..

下面是我的 Project.csproj 文件:

<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<Folder Include="Services\" />
<Folder Include="wwwroot\" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="1.0.0" />
<PackageReference Include="AspNetCore.NPOI" Version="2.3.0" />
</ItemGroup>

<ItemGroup>
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0" />
</ItemGroup>

</Project>

.... 感谢快速回复!

最佳答案

NPOI 2.4 现在支持.NET core 2.0。请从 nuget 更新您的 NPOI 包。

关于c# - 使用 ASP.Net Core 2.0 使用 NuGet NPOI 进行 Excel 解析,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46463991/

相关文章:

c# - Excel Interop - 保存前设置文件名

azure - 从 Azure 函数访问 Azure Batch

c# - 如何使用 C# 检索特定的 XML 标签值

c# - 关于 Linq to Sql 排序的查询

c# - 选择nhibernate二级缓存方案时考虑的因素有哪些

使用不带参数的 Get-Credential 的 Azure 自动化 Runbook

php - 前端性能问题

c# - MVC 4 : How to maintain sessions and cookies to be still valid after IIS restart?

vba - 在运行宏之前从所有工作表中删除过滤

excel - VBA Excel 2007 : Need to loop copy and loop count number except zero every row above