使用 Syncfusion 的 ExcelToPdfConverter 时出现错误的字体和错误的自动调整
Wrong fonts and wrong autofit when using Syncfusion's ExcelToPdfConverter
我目前正在使用 Syncfusion 的 ExcelToPdfConverter
将 XLSX 文档转换为 PDF。
我首先创建 XLSX 文档,然后使用以下代码将其转换为 PDF:
var converter = new ExcelToPdfConverter(workbook);
//Intialize the PDFDocument
var pdfDoc = new PdfDocument();
//Intialize the ExcelToPdfconverterSettings
var settings = new ExcelToPdfConverterSettings();
//Assign the PDFDocument to the TemplateDocument property of ExcelToPdfConverterSettings
settings.TemplateDocument = pdfDoc;
settings.EmbedFonts = true;
//Convert Excel Document into PDF document
pdfDoc = converter.Convert(settings);
//Save the pdf file
pdfDoc.Save(PDFFullPath);
生成的 XLSX 是正确的,看起来应该如此。
转换后的 PDF 不正确。这就像它使用了错误的字体,结果,那些已经用 AutofitRow
自动调整的行被截断了。
以前有其他人遇到过这个问题吗?
有没有办法告诉 PDFConverter
使用正确的字体? (请注意,我使用的是 Arial 和 Calibri,它们都安装在系统字体中)
此致。
我们怀疑问题可能是由于分配了错误的行索引所致。在 XlsIO 中,Row 和 Column 索引是基于一个的。
请参阅以下文档以了解有关 AutofitRow 和 AutofitColumn 的更多信息。
此致,
阿比拉米。
这实际上是 Syncfusion XlsIO 中的一个错误,已在 2017 年 2 月发布的补丁中修复。
上面的代码是正确的。
我目前正在使用 Syncfusion 的 ExcelToPdfConverter
将 XLSX 文档转换为 PDF。
我首先创建 XLSX 文档,然后使用以下代码将其转换为 PDF:
var converter = new ExcelToPdfConverter(workbook);
//Intialize the PDFDocument
var pdfDoc = new PdfDocument();
//Intialize the ExcelToPdfconverterSettings
var settings = new ExcelToPdfConverterSettings();
//Assign the PDFDocument to the TemplateDocument property of ExcelToPdfConverterSettings
settings.TemplateDocument = pdfDoc;
settings.EmbedFonts = true;
//Convert Excel Document into PDF document
pdfDoc = converter.Convert(settings);
//Save the pdf file
pdfDoc.Save(PDFFullPath);
生成的 XLSX 是正确的,看起来应该如此。
转换后的 PDF 不正确。这就像它使用了错误的字体,结果,那些已经用 AutofitRow
自动调整的行被截断了。
以前有其他人遇到过这个问题吗?
有没有办法告诉 PDFConverter
使用正确的字体? (请注意,我使用的是 Arial 和 Calibri,它们都安装在系统字体中)
此致。
我们怀疑问题可能是由于分配了错误的行索引所致。在 XlsIO 中,Row 和 Column 索引是基于一个的。
请参阅以下文档以了解有关 AutofitRow 和 AutofitColumn 的更多信息。
此致,
阿比拉米。
这实际上是 Syncfusion XlsIO 中的一个错误,已在 2017 年 2 月发布的补丁中修复。 上面的代码是正确的。