Issues with kerning when reproducing certain fonts from Excel

Hi there,

We’re using Aspose.cells to reproduce worksheets and one issue we’re encountering is that in some cases, the kerning in reproduced images is not quite consistent with the source for certain fonts.

In this example, you can see the font is Times New Roman, but the kerning is a bit off:
image.png (40.9 KB)

Any recommendations on how we can address this and get fonts to be as close to 100% consistent as possible? Thanks!

@crussell.vena ,

Please share your sample file, code and the output file to analyze and locate your issue.

Hey @peyton.xu,

I’m unable to upload .xlsx and .pptx files through the forum’s text editor - please let me know if there’s a better way to share these files. However, I do have the code to share:

final PageSetup setup = sheet.getPageSetup();
setup.setPrintArea("L12:AB21");

// Set all margins as 0
setup.setLeftMargin(0);
setup.setRightMargin(0);
setup.setTopMargin(0);
setup.setBottomMargin(0);

// set print options
final ImageOrPrintOptions options = new ImageOrPrintOptions();
options.setTransparent(true);
options.setOptimized(true);
options.setOnePagePerSheet(true);
options.setImageType(ImageType.SVG);

Here is another example to consider as well (although not related to kerning), you can see in this image that there are borders and artifacts coming through in the output that are inconsistent with the source in excel:
image.png (71.8 KB)

I hope this helps - Please let me know about sharing the source files.

@crussell.vena,

Thank you for providing the code segment and screenshot.

We need your template Excel file to evaluate your issue. Please zip the XLSX file before attaching it, as it will work.

@amjad.sahi Thanks - here is the sample excel file! One thing to note is that underlying data from the tables you saw in the screenshot has been stripped out, but you can still clearly see the font and borders that not 100% consistent once rendered.

Client Success Metrics - Powerpoint Support (18).xlsx.zip (108.1 KB)

@crussell.vena,

Thanks for providing the XLSX template file.
I tested your scenario using the Excel XLSX file you provided. I used the following sample code with your template XLSX file and generated the attached output SVG.
e.g.
Sample code:

Workbook workbook = new Workbook("f:\\files\\Client Success Metrics - Powerpoint Support (18).xlsx");
//Get the worksheet
Worksheet sheet = workbook.getWorksheets().get("Viz 6 - Contracted Seats");
final PageSetup setup = sheet.getPageSetup();
setup.setPrintArea("L12:AB21");

// Set all margins as 0
setup.setLeftMargin(0);
setup.setRightMargin(0);
setup.setTopMargin(0);
setup.setBottomMargin(0);

// set print options
final ImageOrPrintOptions options = new ImageOrPrintOptions();
options.setTransparent(true);
options.setOptimized(true);
options.setOnePagePerSheet(true);
options.setImageType(ImageType.SVG);
SheetRender sr = new SheetRender(sheet,options);
sr.toImage(0, "f:\\files\\out1 (2).svg"); 

out1 (2).zip (3.1 KB)

I then opened your template XLSX file in MS Excel manually. I set all the options/settings as per the sample code using MS Excel manually. I opened the Page Setup dialog box for the sheet “Viz 6 - Contracted Seats” and set all the margins to 0. Then, I set the printable area to “L12:AB21”. After that, I took the print preview of the sheet and selected “Fit Sheet on One Page”. Upon comparing the Excel print preview of the sheet with the output SVG by Aspose.Cells, I found that both were identical. Please see the screenshot for your reference.
sc_shot1.png (87.8 KB)

@amjad.sahi Thanks for checking! I do see the consistency with the borders, but in your screenshot you can see the issues with font kerning we’re reporting:
Screenshot 2024-04-15 at 11.11.08 AM.png (91.2 KB)

While we can certainly keep monitoring other cases of borders, I think the font kerning issue is pretty important for us to resolve as our customers will use this feature for important high profile meetings and mass distribution.

@crussell.vena,

In the provided screenshot, the highlighted part is a print preview of MS Excel, while the bottom part is an SVG image shown in the browser. In short, since the Excel sheet print preview is shown in minimum zoom level, you are seeing the kerning issue. If you could check the SVG by Aspose.Cells, there is no kerning issue.