nissl-lab / npoi

a .NET library that can read/write Office formats without Microsoft Office installed. No COM+, no interop.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

System.Runtime.CompilerServices.Unsafe 4.0.41 not found while calling AsSpan

softboy99 opened this issue · comments

NPOI Version Used

2.7.0

File Type

  • XLSX
  • XLS

Use Case

update dependency System.Runtime.CompilerServices.Unsafe.dll to 6.0

Description

Hi, can you please explain in details the issue. NPOI hasn't direct dependency on this library
https://www.nuget.org/packages/NPOI/#dependencies-body-tab

Hi,
it's enum.net issue,i have post it to its github site. but now i have another issue, how to open an password protected excel for reading? Is it possible for the 2.7 version?

code:

fs = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read);
WorkbookFactory.Create(fs, true);

exception: “RemoveDataValidation” has not been implemented

Password protection is only available for xlsx files:

IWorkbook workbook = WorkbookFactory.Create("encryped.xlsx", "password");

don't know password

in addition, the enums.net lib author seems doesn't maintian any more :

TylerBrinkley/Enums.NET#42

don't know password

I you don't know the password, you can't open such file.

don't know password

This is illegal. We don't provide this kind of feature.

@softboy99 I checked Enums.NET nuget just now. The last version is just released 3 month ago. Why do you say it's not maintained anymore? Any clues?

Only one question in one issue. If you have other question, please open a new issue. Thanks

在 System.MemoryExtensions.AsSpan(String text)
在 NPOI.SS.Util.CellReference..ctor(String cellRef) 在 C:\Users\ander\Downloads\npoi-master\main\SS\Util\CellReference.cs 中: 第 84 行
在 NPOI.XSSF.UserModel.XSSFCell..ctor(XSSFRow row, CT_Cell cell) 在 C:\Users\ander\Downloads\npoi-master\ooxml\XSSF\UserModel\XSSFCell.cs 中: 第 93 行
在 NPOI.XSSF.UserModel.XSSFRow..ctor(CT_Row row, XSSFSheet sheet) 在 C:\Users\ander\Downloads\npoi-master\ooxml\XSSF\UserModel\XSSFRow.cs 中: 第 285 行
在 NPOI.XSSF.UserModel.XSSFSheet.InitRows(CT_Worksheet worksheetParam) 在 C:\Users\ander\Downloads\npoi-master\ooxml\XSSF\UserModel\XSSFSheet.cs 中: 第 4054 行
在 NPOI.XSSF.UserModel.XSSFSheet.Read(Stream is1) 在 C:\Users\ander\Downloads\npoi-master\ooxml\XSSF\UserModel\XSSFSheet.cs 中: 第 1221 行
在 NPOI.XSSF.UserModel.XSSFSheet.OnDocumentRead() 在 C:\Users\ander\Downloads\npoi-master\ooxml\XSSF\UserModel\XSSFSheet.cs 中: 第 1201 行

Can you create a single console project and reproduce the issue? I'm afraid the issue you are encountering is somewhat related to your package reference in your project.

According to the call stack, this issue is caused by AsSpan method. It's nothing to do with Enums.NET.

@softboy99, check the binding redirects for System.Runtime.CompilerServices.Unsafe