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.

Tue Nov 03, 2020 9:01 pm

Hi,

My company is evaluating Spire.XLS as a replacement for GemBox.Spreadsheet. I am hitting an issue that I have not been able to turn up an answer for with searching.

Here's a trimmed down example of my code:
Code: Select all
public IActionResult GetExcel()
{
    var workBook = new Workbook();
    var workSheetDetail = workBook.Worksheets.Add("Details");
    workSheetDetail[1, 1].Value = "Total:";
    workSheetDetail[1, 1].Style.Font.IsBold = true;
    workSheetDetail.AllocatedRange.AutoFitColumns(); // this line throws the "cannot found font" exception
    using (var stream = new MemoryStream())
    {
        workbook.SaveToStream(stream, FileFormat.Version2016); // if I leave off AutoFitColumns, this line throws the exception
        return File(stream.ToArray(), "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "demo.xlsx");
    }
}


Do I have to load a font from disk? If so, is there example code somewhere for that?

Thanks

bradledbetter
 
Posts: 2
Joined: Tue Nov 03, 2020 8:46 pm

Wed Nov 04, 2020 3:49 am

hello,

Thank you for your inquiry.
I tested your code with the latest Spire.XLS Pack(Hotfix) Version:10.10.6, but did not reproduce this issue on my side. If you are using an older version, please try again with the latest version.
If the issue persists, to help us further investigate it, please tell us your project target framework (e.g. .NET Framework 4.5) and your OS information (e.g. Windows7, 64bit). Thanks in advance.

Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Wed Nov 04, 2020 1:25 pm

Hi,

I've got Spire.Xls 10.10.6 installed from Nuget. Project framework is .Net Core 3.1. My local development environment is MacOS Catalina 10.15.7, though our production environment is Alpine Linux in a docker container.

I tried loading fonts following the guide on your "Spire.XLS 9.7 supports applying external font file to chart and enhances conversions from excel to PDF and Html" page, but got the same exception.

I'll try starting with an empty excel file this morning.

bradledbetter
 
Posts: 2
Joined: Tue Nov 03, 2020 8:46 pm

Thu Nov 05, 2020 9:26 am

Hello,

Thanks for your inquiry.
We tested your case in an environment similar to yours and indeed reproduced your issue. We are sorry for the inconvenience caused.
This issue has been logged into our bug tracking system with the ticket SPIREXLS-2913. If there is any update, we will let you know.

Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Return to Spire.XLS