Custom font is missing from PDF when first saved as a xlsx file

Appears to happen when crossing an async boundary and execution continues on a different thread. Possible async local?

See attached files for sample outputs and test code.

var x = new Class1();
x.Setup();
x.Working();
x.Working2();
x.NotWorking();Excel PDF generation issue.zip (104.0 KB)

@bruceb6,

Thanks for the sample files and code.

We have logged a ticket with an id “CELLSNET-50284” for your issue. We will look into it to figure it out soon. The issue is logged as following:
CELLSNET-50284 - Custom font is missing from PDF when first saved as an XLSX file and crossing an async boundary

Once we have an update on it, we will let you know.

@bruceb6,

We evaluated your issue thoroughly. Generally, using one Workbook instance in multiple threads is not supported, or at least is not recommended. There may be some problems somewhere.

For your case, please set fonts to global by FontConfigs.SetFontFolder API.
e.g
Sample code:

internal void Setup()
{
    FontConfigs.SetFontFolder("C:\\temp\\fonts\\", false);

    LoadOptions options = new LoadOptions();

    _workbook = new Workbook(System.IO.File.Open("C:\\temp\\test.xlsx", System.IO.FileMode.Open, System.IO.FileAccess.Read), options);
}

Hope, this helps a bit.

Thanks Amjad_Sahi, we are using FontSettings to isolate tenants within an application so can’t use the global configuration options.

The application and the sample code only access the workbook one thread at a time. It looks like if there is a async call inbetween access and execution continues on a different thread its having issues.

Yes, it looks so. And, if true, I am afraid, there will be problems as we told you in our previous reply. Anyways, we have logged your details with your existing ticket into our database. We will evaluate it further and get back to you.