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 Aug 13, 2025 9:27 pm

I've done a task using Spire.XLS on .NET 8 to create a new Excel file recently, locally on Windows it worked perfectly, when deploying to production(Linux EC2) I start having errors involving the Spire use. Can anyone help me?

The error occurs when passing this row: Workbook workbook = new Workbook();
The errors that occur are the following:

fail: Finest.Api.Business.Implementations.DigitalReport.DigitalReportBO[0]
Error on ExportCompleteDigitalReportToExcel: The type initializer for 'Spire.Xls.Core.Spreadsheet.XlsPageSetupBase' threw an exception.
fail: Finest.Api.Business.Implementations.DigitalReport.DigitalReportBO[0]
Error on ExportCompleteDigitalReportToExcel: at Spire.Xls.Core.Spreadsheet.XlsPageSetupBase..ctor(Object A_0)
at Spire.Xls.Core.Spreadsheet.XlsPageSetup..ctor(Object A_0)
at Spire.Xls.PageSetup..ctor(Object A_0)
at Spire.Xls.Core.Spreadsheet.XlsWorksheet.InitializeCollections()
at Spire.Xls.Core.Spreadsheet.XlsWorksheetBase..ctor(Object A_0)
at Spire.Xls.Core.Spreadsheet.XlsWorksheet..ctor(Object A_0)
at Spire.Xls.Worksheet..ctor(Object A_0)
at Spire.Xls.Core.Spreadsheet.Collections.XlsWorksheetsCollection.Add(String sheetName)
at Spire.Xls.Core.Spreadsheet.XlsWorkbook.帰(Int32 A_0)
at Spire.Xls.Core.Spreadsheet.XlsWorkbook..ctor(Object A_0)
at Spire.Xls.Workbook..ctor()
at Finest.Api.Business.Implementations.DigitalReport.DigitalReportBO.ExportCompleteDigitalReportToExcel(DateTime referenceDate, List`1 userProfiles) in /src/FinanceUS.Business/Implementations/DigitalReport/DigitalReportBO.cs:line 77
fail: Finest.Api.Business.Implementations.DigitalReport.DigitalReportBO[0]
Inner exception: The type initializer for 'spr娮' threw an exception.
fail: Finest.Api.Business.Implementations.DigitalReport.DigitalReportBO[0]
Inner stack trace: at Spire.Xls.Core.Spreadsheet.XlsPageSetupBase.PaperSizeEntry..ctor(Double width, Double height, MeasureUnits units)
at Spire.Xls.Core.Spreadsheet.XlsPageSetupBase..cctor()

I already tried installing some graphics via Dockerfile:
FROM base AS final
RUN apt-get update \
&& apt-get install -y --allow-unauthenticated \
libc6-dev \
libgdiplus \
libx11-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app

I tried to use Spire DLL reference instead of using the NuGet package but nothing works.

vict0rcarvalh0btg
 
Posts: 1
Joined: Wed Aug 13, 2025 9:20 pm

Thu Aug 14, 2025 4:03 am

Hello,

Thank you for your inquiry.
Spire.XLS offers Linux-compatible edition built on netstandard2.0 architecture. These versions eliminate dependencies on System.Drawing components and are specifically engineered for cross-platform deployment scenarios including .Net 8.0 on Linux.
On Linux systems, please use the DLL files under the netstandard2.0 folder in our product package. You can download the latest package Spire.XLS Pack(hot fix) Version:15.7.8 from the following link on our website. After downloading, extract the package and import the Spire.XLS.dll file from the netstandard2.0 folder into your project. Additionally, install the following dependencies via NuGet:
SkiaSharp >= 3.116.1
System.Buffers >= 4.5.1
System.Memory >= 4.5.5
Microsoft.Win32.Registry >= 4.5.0
System.Text.Encoding.CodePages >= 4.7.0
System.Security.Cryptography.Pkcs >= 4.7.0
System.Security.Cryptography.Xml >=4.7.1
System.Security.Permissions >= 4.7.0
HarfBuzzSharp >=8.3.0.1
SkiaSharp.NativeAssets.Linux.NoDependencies >= 3.116.1
Alternatively, you can search for "Spire.XLSfor.NETStandard" on NuGet and install it.
If you have any questions, please feel free to contact us.
Sincerely,
Talia
E-iceblue support team
User avatar

talia.liu
 
Posts: 341
Joined: Mon Apr 14, 2025 3:33 am

Return to Spire.XLS

cron