Space between text is getting removed while converting grid to emf image using aspose cells in java on linux machine

image.png (3.9 KB)

actual image should be like this .
image.png (4.2 KB)

@Chandra1234
By creating sample file based on screenshots and testing on the latest version v24.4, we can obtain the correct results. Please refer to the attachment. result.zip (8.3 KB)

The sample code is as follows:

Workbook book = new Workbook(filePath + "sample.xlsx");
book.save(filePath + "out_java.emf");

If you have any further questions, please provide your sample file and test code, and we will check it soon.

run below code on window 11 its working fine but same code when i run on linux machine space it getting removed between words .
import com.aspose.cells.ImageOrPrintOptions;
import com.aspose.cells.ImageType;
import com.aspose.cells.SheetRender;
import com.aspose.cells.Workbook;
import com.aspose.cells.Worksheet;

public class AsposeImageGenerator {

public static void main(String[] args) throws Exception {
	String filePath = args[0];
	String imagetPath =args[1];
	Workbook book = new Workbook(filePath);
	Worksheet sheet = book.getWorksheets().get("Sheet1");
	sheet.getPageSetup().setLeftMargin(0);
	sheet.getPageSetup().setTopMargin(0);
	sheet.getPageSetup().setRightMargin(0);
	sheet.getPageSetup().setBottomMargin(0);
	sheet.getPageSetup().setPrintHeadings(false);
	sheet.getPageSetup().setHeader(1, "");
	ImageOrPrintOptions imgOptions = new ImageOrPrintOptions();
	imgOptions.setImageType(ImageType.EMF);
	imgOptions.setOnePagePerSheet(true);
	imgOptions.setQuality(20);
	SheetRender sr = new SheetRender(sheet, imgOptions);
	sr.toImage(0,imagetPath);

}

}

image.png (52.4 KB)

@Chandra1234 ,

Please share us the source excel file and emf images generated on both Windows 11 and Linux.

excel entry.PNG (7.2 KB)

emf generated on linux.PNG (27.8 KB)

emf generated on window.PNG (4.9 KB)

Hi ,
emf file is generating on window perfectly .
when i run same code on linux machine then space between words are getting erased .
may be arial font something is missing if font is missing then please guide me where it need to be installed

@Chandra1234,

Thanks for the screenshots.

It seems your issue might be due to missing fonts on the Linux. Please note, fonts are compulsory for rendering images/PDFs. Please make sure the underlying fonts (.ttf files) are installed on the Linux machine and the fonts folder should be accessible to the application seamlessly (there should not be any rights issue whatsoever). Also, you may set the fonts folder in code at the start of your application and before using any other Aspose.Cells for Java APIs. See the document for your reference.

how will i check fonts are installed or not , what is the default path aspose use for fonts?
why only space between words are getting removed ?

@Chandra1234,

I think if you could check the words(chars) in the output image, they also seem to be changed a bit. We suggest you to kindly read the (suggested) topic and examples, it has all the details for your reference.

Aspose.Cells APIs search the operating system’s default font directory for the required fonts. In case the required fonts are not present then the Aspose.Cells APIs will try to substitute the required fonts with the ones available on the fonts directory. Also, in case the required fonts are not available in the system’s font directory then the APIs search through the custom (user defined) directories. The FontConfigs class has exposed a number of ways to set custom font directories.

same attached code is working fine with aspose-cells-8.6.3 version , ie here space between text is not getting removed on my linux machine but when i am using aspose-cells-24.1.jar version space between text is getting removed when i convert grid to image .
with analysis i found when it find white space between words then text is moving back to two charter back on linux server

@Chandra1234,

Thank you for providing further details.

Could you please try using our latest version/fix, i.e., Aspose.Cells for Java v24.4, to see if it makes any difference? We have made a few enhancements to newer versions regarding rendering spreadsheets. If you still encounter the issue with the latest version, we will need the following to evaluate your issue on our end:

  1. Source Excel file
  2. EMF images generated on Windows 11 and Linux

Please do provide the above mentioned resource files. Once we receive the above artifacts and resource files, we will start investigating the issue and try to figure it out as soon as possible.

Thanks for your cooperation.