Column Width Issue In .NET Core on Linux

I have a .NET Core app which is generating Excel output correctly. When I deploy it to a linux environment, the column widths are not correct. I set them with sheet.Cells.SetColumnWidth(2, 11); but on linux they come out with a width of 10.86.

Have you seen this issue, or anything similar?

In order to get get the application to run, I had to add the below to my Dockerfile

RUN apt-get update
&& apt-get install -y --allow-unauthenticated
libc6-dev
libgdiplus
libx11-dev
&& rm -rf /var/lib/apt/lists/*

I am using Aspose.Cells 19.8.0 from Nuget.

1 Like

@johnroberts,
Thank you for your query. Please share your simple runnable console application containing the minimum code to reproduce this issue along with the template file. We will try the scenario here and provide our feedback afterwards.

Hi, Aspose Column Width Issue.zip (10.2 KB)

This contains a minimum viable example (it is set up as a web service, but it should be the same as a console app). The column width of column C is 11 when run on my windows machine local host. But when deployed out to our dev linux environment, it is 10.86.

For this example, I removed our Aspose license file, just so I wasn’t posting it to a public forum, but we do have an active license with support.

The offending lines seems to be the 4 below. When removed, the Excel has the correct column width in both environments.

       Style defaultStyle = workbook.CreateStyle();
        defaultStyle.Font.Name = "Calibri";
        defaultStyle.Font.Size = 11;
        workbook.DefaultStyle = defaultStyle;

Here is the output xlsx files, that show the issue

localhost (Windows desktop) - sample-dynamic-aspose-localhost.zip (6.3 KB)

dev (Linux kubernetes) - sample-dynamic-aspose-dev.zip (6.3 KB)

@johnroberts,
This issue looks related with missing font. Could you please check if Calibri font is present in Linux environment. If it is not present then try to Set Custom Font Folders and let us know your feedback.

Thanks. Adding the fonts did fix the original issue I was seeing. However, it highlighted another issue.

If I add a value that is very close to overloading the cell and Excel changing to show it as ###, when I render on Windows it works, but when I render on linux it fails.

Here is an example project (loading all the Calibri fonts) - Aspose Html Pound Issue.zip (8.5 MB)

I did leave out my license file.

And here are the two HTML outputs
Windows - sample-dynamic-aspose-pound-issue-localhost.zip (1.8 KB)

Linux - sample-dynamic-aspose-pound-issue-dev.zip (1.8 KB)

Is there something else I need for this to render the same in both environments? It doesn’t seem to be an issue with the column width anymore. Both Excel outputs look fine, it’s just the HTML version.

Thanks,

@johnroberts,
We have logged the issue in our database for investigation and for a fix. Once, we will have some news for you, we will update you in this topic.

This issue has been logged as

CELLSNET-47009 - Issue with output HTML

Thanks for the update.