Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Thu Jul 11, 2019 12:24 pm

Hey, I am having the following error


Code: Select all
Could not load type 'spr᝙' from assembly 'Spire.Doc, Version=7.1.13.41320, Culture=neutral, PublicKeyToken=663f351905198cb3' because it attempts to implement a class as an interface.

while executing this code in a .Net core Web app.

Code: Select all
var document = new Spire.Doc.Document();
document.LoadFromFile(pathImpresion);
document.SaveToFile(pathPDF, FileFormat.PDF);


How can I solve it? Thanks in advance.

EVila
 
Posts: 2
Joined: Thu Jul 11, 2019 12:18 pm

Fri Jul 12, 2019 3:00 am

Hello,

Thanks for your inquiry.
I tested your case with our FreeSpire.Doc, It could work well for a .Net Core Web app. As for your situation, I suggest that you remove all dlls related to our product in your project, and then re-install the FreeSpire.Doc 7.1.13 package via Nuget to try again. If there is still any question after trying, please share us with your runnable application to help further look into it, you could upload it via OneDrive or DropBox and then share us with the link via email (support@e-iceblue.com).

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1261
Joined: Wed Apr 25, 2018 3:20 am

Fri Jul 12, 2019 6:27 am

Thank you, it worked.

EVila
 
Posts: 2
Joined: Thu Jul 11, 2019 12:18 pm

Fri Jul 12, 2019 8:02 am

Hello,

Glad to hear that! If you encounter any issue related to our products in the future, just feel free to contact us.
Wish you all the best!

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1261
Joined: Wed Apr 25, 2018 3:20 am

Sun Sep 15, 2019 8:44 am

Hi Team,

I also get the same issue when using FreeSpire.Doc as follow exception message:
Code: Select all
Could not load type 'spr?' from assembly 'Spire.Doc, Version=7.1.13.41320, Culture=neutral, PublicKeyToken=663f351905198cb3' because it attempts to implement a class as an interface.


I also tried to remove the dll, clean my project and rebuild it again many time, but, unlucky me, the error still there.
Please help me, thanks!

luannguyend
 
Posts: 3
Joined: Tue Sep 10, 2019 2:39 pm

Mon Sep 16, 2019 2:51 am

Hi,

Thanks for your inquiry and sorry to reply late for weekend.
Please check whether the configuration file in your project contains the configuration information of our products. If so, please remove all the configuration information related to our products first. After that, please remove all the Spire.Doc dlls in your project, and then add FreeSpire.Doc dlls or re-install the FreeSpire.Doc 7.1.13 package via NuGet and try again.
If the issue still exists, to help us better investigate it, please offer us a runnable project which could reproduce your issue directly. You could upload it here or send us(support@e-iceblue.com) via email.

Best wishes,
Amber
E-iceblue support team
User avatar

Amber.Gu
 
Posts: 525
Joined: Tue Jun 04, 2019 3:16 am

Wed Sep 18, 2019 2:05 pm

Thanks for replying.
I've tried to remove all previous references then only adding again Spire.Office. It works fine now.

Unfortunately, one of my developers, who is using MacBook Pro instead of Windows laptop, got another issue that raised
The type initializer for 'Gdip' threw an exception

when trying to set the page margin as following code
Code: Select all
PdfDocument pdf = new PdfDocument();
pdf.PrintSettings.SetPaperMargins(0, 0, 0, 0);


Could you please give me some advice on this also?

Os : MacOS Mojave 10.14.6

luannguyend
 
Posts: 3
Joined: Tue Sep 10, 2019 2:39 pm

Thu Sep 19, 2019 4:08 am

Hi,
After some investigation and googling, I found a solution, it works fine for me now.
We need to add the missing libs, we can install it by:
Code: Select all
brew install mono-libgdiplus

Hope everyone who has the same issues could resolve the problem.

So, my problems is properly gone now.

Enjoy coding.

luannguyend
 
Posts: 3
Joined: Tue Sep 10, 2019 2:39 pm

Thu Sep 19, 2019 10:00 am

Hi,

Thanks for sharing the solution.
If there is any question, welcome to get it back to us.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Mon Jun 20, 2022 1:35 pm

Hi
I am trying to use the FreeSpire.xls module from nuget.
at the first command, "var workbook = new Workbook();" i get the following:
'Could not load type 'sprᣈ' from assembly 'Spire.XLS, Version=12.2.0.0, Culture=neutral, PublicKeyToken=663f351905198cb3' because it attempts to implement a class as an interface.'

i followed your instructions to remove all references of spire, then add them again, clean, rebuild...nothing resolves it.
the package installed is "FreeSpire.XLS", and this is ALL my code (.net core 6 console app):
Code: Select all
using Spire.Xls;

Testing.readXL();

Console.WriteLine("done!");
Console.ReadKey();

public static class Testing
{
    public static void readXL()
    {
        var row = 2;
        var workbook = new Workbook();
        workbook.LoadFromFile(@"C:\Users\Erez\Projects\Intel\test.xlsx");

        Worksheet sheet = workbook.Worksheets[0];
        while (row < 100)
        {
            Console.WriteLine($"{sheet.Range[row, 1].Value} - {sheet.Range[row, 3].Value} - {sheet.Range[row, 5].Value} - {sheet.Range[row, 6].Value}");
            row++;
        }

        workbook.Dispose();
    }
}

ErezMor_IB
 
Posts: 1
Joined: Mon Jun 20, 2022 1:23 pm

Tue Jun 21, 2022 5:34 am

Hi,

Thank you for your inquiry.
I installed the Free Spire.XLS for .NET Version:12.2 from Nuget and did an initial test, but did not reproduce your problem. If you also installed other spire products except Spire.XLS in your project, please remove other Spire products to test again since two or more independent products is incompatible in a same project. If this doesn't help, please share your sample demo which could reproduce your problem to help us do an accurate investigation and help you out. You can upload your demo via Google Drive and share us with the download link.

Sincerely,
Kylie
E-iceblue support team
User avatar

kylie.tian
 
Posts: 412
Joined: Mon Mar 07, 2022 2:30 am

Thu Aug 11, 2022 7:08 pm

Hi,

I'm having the same issue that ErezMor_IB has.
I'm trying to manipulate an excel file in an ECS cluster in AWS using .Net Core 3.1. I've installed libgdiplus before deploying my app.
I got FreeSpire.XLS v12.7.0 from Nuget, then I've created a new Workbook instance and manipulated it. But when I tried to save a PDF file, I've got this error (whthout inner exception):

Code: Select all
// getting file from an S3 bucket
using var templateStream = await GetTemplateStreamAsync().ConfigureAwait(false);
using var workbook = new Workbook();
workbook.LoadFromStream(templateStream);

//doing work...

workbook.SaveToFile(fileName: "app/src/pdfs/my_pdf.pdf", FileFormat.PDF); //having exception here


Code: Select all
The type initializer for 'sprᵎ' threw an exception.


Initially, I tought that it could be an missing dependency from Pdf Nuget Package. So, I downgraded FreeSpire.XLS to v11.8.6 and istalled FreeSpire.Pdf v7.8.9, all from Nuget. Now, this exception was thrown (whthout inner exception):

Code: Select all
// getting file from an S3 bucket
using var templateStream = await GetTemplateStreamAsync().ConfigureAwait(false);
using var workbook = new Workbook(); //having exception here
workbook.LoadFromStream(templateStream);

//doing work...

workbook.SaveToFile(fileName: "app/src/pdfs/my_pdf.pdf", FileFormat.PDF);


Code: Select all
Could not load type 'spr᠔' from assembly 'Spire.XLS, Version=11.8.6.0, Culture=neutral, PublicKeyToken=663f351905198cb3' because it attempts to implement a class as an interface.


I'm having this issue only running my app on ECS' cluster. It works fine on my Windows machine.

Could you help me to solve this issue?
Kind regards.

rennan.rezende
 
Posts: 1
Joined: Thu Aug 11, 2022 6:52 pm

Fri Aug 12, 2022 10:00 am

Hi,

Thank you for your inquiry.
Kindly note the Spire.XLS and Spire.PDF are two independent products, they can't be used together in a same project due to the incompatible. So please remove the Spire.PDF from your project to have a test.
If the exception "The type initializer for 'sprᵎ' threw an exception." still exists on your side, I guessed the issue might be related to the libgdiplus dependency. We provide the dlls for NetStandard, which doesn't depend on libgdiplus. Please download the latest Spire.XLS Pack(Hotfix) Version:12.7.1 from our website and manually add the DLLs from the folder “netstandard2.0” in your project, also install the following dependencies via NuGet to have a test on your ECS cluster in AWS.
SkiaSharp >= 1.68.0
System.Text.Encoding.CodePages >= 4.5.0
System.Security.Cryptography.Xml >=4.5.0
SkiaSharp.NativeAssets.Linux.NoDependencies

If it does not help you, please provide some steps about deploying your app in ECS cluster and other helpful documentation to help us quickly and accurately investigate your issue. Thanks in advance.

Sincerely,
Kylie
E-iceblue support team
User avatar

kylie.tian
 
Posts: 412
Joined: Mon Mar 07, 2022 2:30 am

Fri Nov 11, 2022 7:42 pm

In your post , Tue Jun 21, 2022 5:34 am,

You stated "two or more independent products is incompatible in a same project". If I need spire.doc and spire.xls for my project , do I need to install spire.office ? Do I need to purchase spire.office or i can just purchase spire.doc and spire.xls individually?

Thanks
Duke

dukie017@yahoo.com
 
Posts: 1
Joined: Tue Jul 24, 2012 3:40 pm

Mon Nov 14, 2022 3:43 am

Hi Duke,

Thanks for your inquiry and sorry to reply late for weekend.
Yes, you need to install our Spire.Office in your project as all dlls in Spire.Office are compatible. You can just purchase spire.doc and spire.xls individually, and refer to this tutorial to apply two or more licenses:
https://www.e-iceblue.com/Tutorials/Licensing/Licensing.html#Apply_two_Licenses
Website download link: https://www.e-iceblue.com/Download/download-office-for-net-now.html
Nuget download link: https://www.nuget.org/packages/Spire.Office/
If you have any issue, just feel free to contact us.
Sincerely,
Doris
E-iceblue support team
User avatar

Doris.Liu
 
Posts: 66
Joined: Mon Nov 07, 2022 8:10 am

Return to Spire.Doc