Spire.XLS is a professional Excel API that enables developers to create, manage, manipulate, convert and print Excel worksheets. Get free and professional technical support for Spire.XLS for .NET, Java, Android, C++, Python.

Fri Jul 22, 2022 4:28 pm

I am usign Spire.Doc 9.4.1 , I need to convert an XLS file to PDF file so I install Spire.Xls 9.4.0 and has de code

Workbook workbook = new Workbook();
workbook.LoadFromStream(excel_stram);

workbook.SaveToStream(ms3, Spire.Xls.FileFormat.PDF);
var xlsx_pdf = new PdfDocument(ms3);

But in Workbook workbook = new Workbook(); i get the error The type initializer for 'sprឳ' threw an exception

The proyect in in .net 5

What can i do to get this error (" The type initializer for 'sprឳ' threw an exception")

camila.pm
 
Posts: 2
Joined: Fri Jul 22, 2022 4:05 pm

Mon Jul 25, 2022 1:33 am

Hello,

Thanks for you inquiry.

You cannot use Spire.Doc and Spire.Xls in the same project at the same time due to conflicts between different Spire products. This is what causes this error.
In order to solve this, please completely remove Spire.Doc and Spire.Xls from the project first, and then install Spire.Office (a collection that contains almost all Spire product functions). Hope it helps you.
Sincerely,
Andy
E-iceblue support team
User avatar

Andy.Zhou
 
Posts: 483
Joined: Mon Mar 29, 2021 3:03 am

Fri Jul 29, 2022 6:40 pm

Thx, this solution works perfect :D

camila.pm
 
Posts: 2
Joined: Fri Jul 22, 2022 4:05 pm

Return to Spire.XLS