Text Overlap Issue In Cells After Converting .XLSX file to .PPTX file

Hi Team,

Currently I’m using aspose-cells-17.8 for java.

I have an .xlsx file which contains some text in some cells. After converting this .xlsx to .pptx (with or without OLE) the text in the cells are getting overlapped

We can see this issue only in the case of Linux environment that to only for .pptx. In windows environment this conversion is fine without any Text Overlap issue.

Since the data is sensitive we are not able to share the .xlsx file used.

Attaching the sample code used to convert .xlsx to .pptx and also the screenshot of the issue.

Kindly help us on this issue.

Regards,
Sanjeev

TextOverlapIssue.zip (36.9 KB)

@sanjeevkumarambti,

Thanks for the sample code and screenshot.

Well, I think you issue might be missing font(s) issue on Linux environment. Generally, Linux environments usually lack the Windows fonts therefore it is best to inspect the Workbook (file) for used fonts and make sure all the required fonts (used in the workbook) are available to the APIs. This is compulsory for rendering spreadsheets to image file(s).

Please note that Aspose.Cells for Java API scans the “/usr/share/fonts” directory and its sub directories for font files (TTF & TTC) as a default behaviour. That means, if you place all the required fonts on aforementioned location, you do not need to explicitly set the font location in your code. All you need to do is put all the required fonts there. But if you use some custom folder (where you put the required fonts), you have to explicitly set the font folder path in code at the start of your program, see the documents in the section for your reference:

Hope, this helps a bit.

Thank you.

Hi Team,

Thanks for the valuable suggestion.
But we are maintaining a custom folder for fonts and is mapped properly in our application.
We confirm that this issue is not because of the fonts on Linux environment.

Thanks in advance,
Sanjeev

@sanjeevkumarambti,

I still think your custom fonts folder may not be accessible to Aspose.Cells APIs or the underlying fonts are not present in the folder, so you should specify the fonts folder path correctly at the start. Moreover, you may try to save the file to PDF by adding a line to your code segment:
e.g
Sample code:

...........
workbook.save(strFilePath, SaveFormat.PDF);

Now open the output PDF file into Adobe acrobat and click the “Properties” menu item in File menu. In the dialog, check the fonts used to render to PDF in “Fonts” tab if these ok and there is no missing or replaced fonts mentioned there.

If you still could not evaluate it, I am afraid, we need your template Excel file and output image file and/or PDF file via Aspose.Cells for Java v17.8.3, we will check it soon.

Hi Amjad Sahi,

Please find the attached .xlsx sample and also pdf and .pptx files generated using the .xlsx sample for your analysis.

Note : Text overlap issue occurs only in PPTX output but not in PDF.

Thanks in advance,
Sanjeev

TextOvelapIssueSamples.zip (86.5 KB)

@sanjeevkumarambti,

Thanks for the sample files.

This is really strange as generally Aspose.Cells renders PDF and images the same way. So if PDF is fine then output image of the sheet (by Aspose.Cells APIs) is also fine. I checked your sample files and it uses “Calibri” font. Could you simply separate the issue regarding Sheet to image and just renders the sheet to image only by opening your attached Excel file using the following sample code (don’t uncomment the lines).
e.g
Sample code:

// Open an Excel file.
Workbook workbook = new Workbook(strFilePath);

ImageOrPrintOptions imgOpt = new ImageOrPrintOptions();
imgOpt.setImageFormat(ImageFormat.getEmf());
//imgOpt.setCheckWorkbookDefaultFont(false);
//imgOpt.setDefaultFont("Calibri");
SheetRender sr = new SheetRender(workbook.getWorksheets().get(0), imgOpt);
sr.toImage(0, strImageFilePath);

If this does not work then uncomment the lines and re-render to image file.

Please share both your image files with us.

@sanjeevkumarambti,

We have looked into your issue in details and checked your shared PDF file and the output EMF file inside the pptx file. Well, there are three fonts used in the source xlsx: Arial Regular, Calibri Regular, Calibri Bold. In the PDF file, only Calibri Regular, Calibri Bold fonts are used, but in the EMF file, only Arial Regular, Calibri Regular fonts are used, the missing of Calibri Bold font caused the text overlapping issue. Also, it seems that the PDF file and the EMF file were not generated in the same environment.

Please make sure Arial Regular(arial.ttf), Calibri Regular(calibri.ttf), Calibri Bold(calibrib.ttf) fonts are available on your env, and they are set to be used by Aspose.Cells (e.g. use FontConfigs.setFontFolder(string fontFolder, bool recursive)). Then use the following sample code to generate the PDF file and EMF file at the same time:
e.g
Sample code:

  Workbook wb = new Workbook(sourcePath + "TextOverlapIssue.XLSX");
  System.out.println(wb.getDefaultStyle().getFont());
  
  wb.save(destPath + "test_Java.pdf");
  
  Worksheet sheet = wb.getWorksheets().get("Chart");
     
     sheet.getPageSetup().setLeftMargin(0.0);
     sheet.getPageSetup().setRightMargin(0.0);
     sheet.getPageSetup().setTopMargin(0.0);
     sheet.getPageSetup().setBottomMargin(0.0);
    
     ImageOrPrintOptions imageOptions = new ImageOrPrintOptions();
     imageOptions.setImageFormat(ImageFormat.getEmf());
     imageOptions.setOnePagePerSheet(true);
     imageOptions.setOnlyArea(true);
        
     SheetRender sheetRender = new SheetRender(sheet, imageOptions);
     sheetRender.toImage(0, destPath + "test_Java.emf");

If the issue still exists, please share us the generated PDF file and EMF file, we will check it soon.

Hi Team,

This is a regression issue and was already fixed as part of aspose-cells-8.8.2.8.jar.

For more details please refer to the previous post raised as below :

Fact labels overlapping in the merged cell

The fix provided was working till aspose-cells-17.1.2.jar.

Currently I tested with aspose-cells-17.8.7.jar and still this issue can be replicated.

Please consider this issue as of high priority as it is impacting several reports.

Thanks in advance,
Sanjeev

@sanjeevkumarambti,

We will investigate your issue soon.

In the meantime, could you do the following steps using Aspose.Cells for Java v17.8.7:

  1. Make sure Arial Regular(arial.ttf), Calibri Regular(calibri.ttf), Calibri Bold(calibrib.ttf) fonts are available on your env, and they are set to be used by Aspose.Cells (e.g. use FontConfigs.setFontFolder(string fontFolder, bool recursive) at the start of your Java program).

  2. Use the following sample code to generate the PDF file and EMF file at the same time:
    e.g
    Sample code:

    FontConfigs.setFontFolder("…your font folder path…", true);
    Workbook wb = new Workbook(sourcePath + “TextOverlapIssue.XLSX”);
    System.out.println(wb.getDefaultStyle().getFont());

    wb.save(destPath + “test_Java.pdf”);

    Worksheet sheet = wb.getWorksheets().get(“Chart”);

      sheet.getPageSetup().setLeftMargin(0.0);
      sheet.getPageSetup().setRightMargin(0.0);
      sheet.getPageSetup().setTopMargin(0.0);
      sheet.getPageSetup().setBottomMargin(0.0);
     
      ImageOrPrintOptions imageOptions = new ImageOrPrintOptions();
      imageOptions.setImageFormat(ImageFormat.getEmf());
      imageOptions.setOnePagePerSheet(true);
      imageOptions.setOnlyArea(true);
         
      SheetRender sheetRender = new SheetRender(sheet, imageOptions);
      sheetRender.toImage(0, destPath + "test_Java.emf");
    
  3. Please share us the generated PDF file and EMF file here.

  4. Share a screenshot showing your fonts folder conforming the required fonts are there in your folder.

@sanjeevkumarambti

Thanks for using Aspose APIs.

We were able to observe this issue and logged it in our database for investigation and for a fix. Once, the issue is resolved or we have some other news for you, we will update you asap.

This issue has been logged as

  • CELLSJAVA-42408 - Text overlap Issue after rendering Worksheet to Image

@sanjeevkumarambti,

Please try our latest version/fix: Aspose.Cells for Java v17.9.1.

Your issue should be fixed in it.

Let us know your feedback.

The issues you have found earlier (filed as CELLSJAVA-42408) have been fixed in Aspose.Cells for Java 17.10.