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.

Wed Nov 10, 2021 10:57 am

Hi everyone,

This problem might have already been encoutered I guess but I didn't find it so any help would be very appreciated :)
So here is my code:

using System;
using System.Text;
using System.Windows.Forms;
using Spire.Xls;
using System.IO;

Spire.Xls.Workbook Wb = new Spire.Xls.Workbook();
Worksheet sheet = Wb.Worksheets[0];
sheet.Range["A1"].Text = "Hello world";
Wb.SaveToFile(@"Disk:\Users\myself\mypath\Project_name\Test.xlsx",ExcelVersion.Version2016);
System.Diagnostics.Process.Start(Wb.FileName);

Basically, the program blocks to this line "Spire.Xls.Workbook Wb = new Spire.Xls.Workbook();" and gives me this error message:

"System.TypeLoadException: 'Impossible de charger le type 'spr᠜' à partir de l'assembly 'Spire.XLS, Version=11.8.6.0, Culture=neutral, PublicKeyToken=mytoken', car il essaie d'implémenter une classe en tant qu'interface.'"
That means that I cannot charge 'spr᠜' type from the assembly 'Spire.XLS, Version=11.8.6.0, Culture=neutral, PublicKeyToken=mytoken' because the program tries to implement a class as an interface.

What could be the cause of this issue please ?

Thanks in advance for helping and have a great day.

Pierre

Pgiugla06
 
Posts: 4
Joined: Wed Nov 10, 2021 10:46 am

Thu Nov 11, 2021 2:13 am

Hello,

Thank you for your inquiry.
Did you install Spire.XLS and other components (such as Spire.Doc) in the same project? Kindly note that each component is independent and incompatible, so you cannot have multiple independent components in one project. If you need to use two or more components, please only install Spire.Office, which is the combination of our .NET components including Spire.XLS and Spire.Doc...
Please remove all the DLLs related to our products in the project, and then install Spire.XLS or Spire.Office from Nuget Manager.
If there is still any question, please feel free to write back.

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 1648
Joined: Wed Apr 07, 2021 2:50 am

Fri Nov 12, 2021 1:12 pm

Thanks Annika,

Indeed, the problem was coming from this. I'll get the office package.

Best regards,
Pierre

Pgiugla06
 
Posts: 4
Joined: Wed Nov 10, 2021 10:46 am

Mon Nov 15, 2021 12:55 am

Hello,

You're welcome.
If you have other questions about using our products in the future, please feel free to contact us.

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 1648
Joined: Wed Apr 07, 2021 2:50 am

Return to Spire.XLS