Hello There,
I am loading a document in Aspose.Cells.Workbook ( Version=22.5.0.0) and changing the custom font of sheet then trying save to PDF but its not changing the font in output PDF file.
Below is my code.
var wb = new Aspose.Cells.Workbook("FilePath");
var sheet1 = wb.Worksheets[0];
FontConfigs.SetFontSources(new FontSourceBase[] { new Aspose.Cells.MemoryFontSource(System.IO.File.ReadAllBytes("C:\\Users\\MyUser\\Downloads\\ot_ttf\\Dubai-Medium.ttf")) });
FontConfigs.DefaultFontName = "Dubai Medium";
var style = sheet1.Cells["A3"].GetStyle();
style.Font.Name = "Dubai Medium";
style.Font.Color = System.Drawing.Color.Green;
sheet1.Cells["A3"].SetStyle(style);
sheet1.Cells[$"A16"].Value = "RemainingPayment";
sheet1.Cells[$"E16"].Value = "AmountToSpent";
sheet1.Cells[$"A17"].Value = "InvoiceNumber";
wb.Save("C:\\Users\\Test.pdf", Aspose.Cells.SaveFormat.Pdf);
Can you please help if I am missing anything.
@Dubai_Sports_Council,
Could you please move the lines of code that use FontConfigs API at the start of the application, that is; before invoking any other objects of Aspose.Cells APIs:
FontConfigs.SetFontSources(new FontSourceBase[] { new Aspose.Cells.MemoryFontSource(System.IO.File.ReadAllBytes("C:\\Users\\MyUser\\Downloads\\ot_ttf\\Dubai-Medium.ttf")) });
FontConfigs.DefaultFontName = "Dubai Medium";
var wb = new Aspose.Cells.Workbook("FilePath");
If you still find the issue, kindly do provide your input Excel file, output PDF file and underlying font files (.ttf). We will check your issue soon.
I have tried the way explained but not working.
I am uploading files for your reference.
aspose font problem.zip (824.2 KB)
@Dubai_Sports_Council
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): CELLSNET-52735
You can obtain Paid Support services if you need support on a priority basis, along with the direct access to our Paid Support management team.
Any update regarding that issue ?
Thank you !
@Dubai_Sports_Council
For Cell A3, we mapped it’s RTL chars to get correct display in pdf, however, this makes the set font Dubai Medium
can’t show the chars that had been mapped.
We can’t fix it currently.
I did not understand, can you please explain your answer ?
@Dubai_Sports_Council,
We will explain and clarify it soon.
@Dubai_Sports_Council
For RTL text, the text displayed and the under glyphs may be different. Maybe we do something wrong during the process that makes the set font Dubai Medium
can’t show the processed glyphs. So other font is used.