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 Jun 21, 2024 3:50 am

1. Input file: Very simple excel file with 3 columns and 2 rows
2. Code:
Code: Select all
Workbook workbook = new Workbook();
workbook.LoadFromFile("Book1.xlsx");
Worksheet sheet = workbook.Worksheets[0];
using var stream= sheet.ToImage( 1, 1, 2, 3);

3. Version: FreeSpire.XLS Version="14.2.0"
4. Alpine
5. ASP.Net API using net8.0

Exception:

Code: Select all
System.NullReferenceException: Object reference not set to an instance of an object.
at spr愖.廏()
at spr悬..ctor(spr愖 A_0)
at spr悬..ctor(spr愖 A_0, Single A_1)
at spr悬..ctor(spr愖 A_0, Single A_1, spr態 A_2)
at spr悬..ctor(spr愖 A_0, Single A_1, spr態 A_2, spr憵 A_3)
at spr悬..ctor(spr愖 A_0, Single A_1, spr態 A_2, spr憵 A_3, Byte A_4



My code worked fine in windows and ubuntu but cannot work in alpine
Please see my Dockerfile for more detail

haison8x
 
Posts: 5
Joined: Thu Aug 16, 2012 4:15 am

Fri Jun 21, 2024 3:52 am

Here is my docker file
Code: Select all
FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS builder

WORKDIR /src

COPY ./MyProject/MyProject.csproj ./MyProject/MyProject.csproj


WORKDIR /src/MyProject
RUN dotnet restore -v diag

COPY ./MyProject .
RUN dotnet  publish -c Release -r linux-musl-x64 -o /app

FROM mcr.microsoft.com/base/dotnet/core/aspnet:8.0-alpine AS base

WORKDIR /app
COPY --from=builder /app .

ENV TZ="America/La_Paz"

RUN apk update && apk add nano
RUN apk add --no-cache fontconfig
RUN ln -s /usr/lib/libfontconfig.so.1 /usr/lib/libfontconfig.so && \
    ln -s /lib/libuuid.so.1 /usr/lib/libuuid.so.1 && \
    ln -s /lib/libc.musl-x86_64.so.1 /usr/lib/libc.musl-x86_64.so.1
ENV LD_LIBRARY_PATH /usr/lib

ENTRYPOINT ["dotnet", "MyProject.dll"]

haison8x
 
Posts: 5
Joined: Thu Aug 16, 2012 4:15 am

Fri Jun 21, 2024 10:27 am

Hello,

Thanks for your inquiry.
Yes, I did encounter some issues with our free version on Alpine, but they are not the same as what you mentioned. Could you pleae provide us with your complete error message so that we can investigate further?

Sincerely,
William
E-iceblue support team
User avatar

William.Zhang
 
Posts: 451
Joined: Mon Dec 27, 2021 2:23 am

Tue Jun 25, 2024 4:41 am

Here is the error message.
You can get my simple code at here: git@github.com:haison8x/testfreespire.git
Code: Select all
Cannot found font installed on the system.
   at spr귁.跂(String A_0, spr態 A_1, String A_2)
   at spr愖..ctor(String A_0, spr態 A_1)
   at spr悬..ctor(String A_0, Single A_1, spr態 A_2)
   at spr莊.帰(String A_0, Single A_1, spr態 A_2)
   at sprᴃ.帰(spr憀 A_0, spr忢 A_1, sprᦳ A_2, spr莊 A_3, Int32 A_4)
   at sprᴃ.帰(spr憀 A_0, spr忢 A_1, sprᦳ A_2, spr莊 A_3)
   at sprᴃ.帰(spr忢 A_0)
   at spr萩.渡()
   at spr聯.庚(Int32 A_0)
   at spr聯.帰(Int32 A_0, Boolean A_1, Boolean A_2)
   at spr焅.幥(XmlTextReader A_0, Int32 A_1)
   at spr焅.弹(XmlTextReader A_0)
   at spr焅.撛(XmlTextReader A_0)
   at spr瀱.帰(spr窋 A_0, String A_1, Boolean A_2)
   at spr瀱.幥(spr窋 A_0, String A_1, Boolean A_2)
   at spr瀱.廏(spr窋 A_0, String A_1)
   at spr瀱.弄()
   at spr瀱.揼()
   at spr濼.帰(spr荕 A_0)
   at spr荕.帰(Stream A_0, spr漋 A_1, Boolean A_2)
   at spr荕.帰(String A_0, spr漋 A_1)
   at spr荕..ctor(String A_0, spr漋 A_1)
   at Spire.Xls.Core.Spreadsheet.XlsWorkbook..ctor(Object A_0, String A_1, ExcelVersion A_2)
   at Spire.Xls.Workbook.LoadFromFile(String fileName, ExcelVersion version)
   at Spire.Xls.Workbook.LoadFromFile(String fileName)
   at Test.TestFreeSpire.FromXls() in /src/Test/TestFreeSpire.cs:line 10
   at Program.<>c.<<Main>$>b__0_2() in /src/Test/Program.cs:line 17

haison8x
 
Posts: 5
Joined: Thu Aug 16, 2012 4:15 am

Tue Jun 25, 2024 7:03 am

My issue may relate this issue
getting-error-cannot-found-font-installed-on-the-system-t12920-15.html

Let me try the solution mentioned there

haison8x
 
Posts: 5
Joined: Thu Aug 16, 2012 4:15 am

Tue Jun 25, 2024 7:34 am

My problem is solved by install some packages:

Code: Select all
RUN apk update && apk add nano
RUN apk --no-cache add msttcorefonts-installer fontconfig && \
    update-ms-fonts && \
    fc-cache -f
RUN apk --no-cache add icu-libs libc6-compat

haison8x
 
Posts: 5
Joined: Thu Aug 16, 2012 4:15 am

Thu Jun 27, 2024 2:57 am

Hello,

Thanks for your reply.
Glad to hear you found a solution. If you have any other questions about our products in the future, please feel free to write to us.

Sincerely,
William
E-iceblue support team
User avatar

William.Zhang
 
Posts: 451
Joined: Mon Dec 27, 2021 2:23 am

Return to Spire.XLS