使用Syncfusion的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 中,行索引和列索引基于一个。

请参阅以下文档以了解有关 AutofitRow 和 AutofitColumn 的更多信息。

文档链接: https://help.syncfusion.com/file-formats/xlsio/worksheet-rows-and-columns-manipulation#auto-fit-a-single-row-or-column

问候

阿比拉米。

这实际上是Syncfusion XlsIO中的一个错误,已在2017年2月发布的补丁中修复。上面的代码是正确的。

最新更新