i need show two fonts in a single cell, i use two TextFragment and set the font,it’s ok。
but If I set the default font(row or table),it will not work. image.png (25.1 KB)
public void CreateDemo(string savepath)
{
Font FontA = FontRepository.FindFont(“SimSun”);
Font FontB = FontRepository.OpenFont(@“d:\SpecialFont.ttf”);
Document doc = new Document();
Page page = doc.Pages.Add();
Aspose.Pdf.Table tabcontent = new Aspose.Pdf.Table();
page.Paragraphs.Add(tabcontent);
tabcontent.ColumnWidths = "200";
tabcontent.DefaultCellBorder = new Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.All, 0.1F);
tabcontent.Border = new Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.All, 1F);
Aspose.Pdf.MarginInfo margin = new Aspose.Pdf.MarginInfo(5,5,5,5);
tabcontent.DefaultCellPadding = margin;
//first row
var row = tabcontent.Rows.Add();
var cell = new Cell();
var sptxt = new TextFragment("页面Page");
sptxt.TextState.Font = FontA;
cell.Paragraphs.Add(sptxt);
row.Cells.Add(cell);
//second row
var row2 = tabcontent.Rows.Add();
var cell2 = new Cell();
var sptxt2 = new TextFragment("");
sptxt2.TextState.Font = FontB;
cell2.Paragraphs.Add(sptxt2);
row2.Cells.Add(cell2);
//third row
var row3 = tabcontent.Rows.Add();
var cell3 = new Cell();
sptxt = new TextFragment("页面Page");
sptxt2 = new TextFragment("");
sptxt.TextState.Font = FontA;
sptxt2.TextState.Font = FontB;
sptxt2.IsInLineParagraph = true;
cell3.Paragraphs.Add(sptxt);
cell3.Paragraphs.Add(sptxt2);
row3.Cells.Add(cell3);
//if set the default font,it will not work
//cell3.DefaultCellTextState.Font = FontA;
//row3.DefaultCellTextState.Font = FontA;
//tabcontent.DefaultCellTextState.Font = FontA;
doc.Save(savepath);
Would you kindly share the other font file which you are using from a file path. Also, please share which language character are you adding inside table cell. We will test the scenario in our environment and address it accordingly.
We were still unable to notice the issue in our environment while testing the scenario with Aspose.PDF for .NET 21.2. Would you kindly share the special random characters that you created using the Windows Tool. You can add them into a file and share that file in .zip format with us. This would help us testing the scenario accordingly.
We apologize for the inconvenience being faced. But we were still unable to notice the issue. Would you please share the PDF file where special character text is added correctly and the other file where they are appearing as blocks if font is set as default font. We will further proceed accordingly.
You can notice in the attached PDF that all text was rendered correctly. It is quite possible that issue is related to some specific special characters or symbols. That is why we asked for the PDF file in which characters were correctly displayed at your side so that we can use the same symbols at our end to test the scenario and share our feedback with you accordingly.
We have logged an issue as PDFNET-49590 in our issue tracking system for further investigation. We will look into its details and keep you posted with the status of its correction. Please be patient and spare us some time.