Hi,
I am currently using evaluation version of Aspose.Cells (7.0.0), I am trying to add the image with percentage and aspect ratio would remain as is.
I am using the PictureCollection.add(int upperLeftRow, int upperLeftColumn, java.io.InputStream stream, int widthScale, int heightScale) where in api documentation found it says widthScale and heighScale are in “a percentage”.
In the sample code below as you can see I am adding two images from the same source with dimensions 204 X 1082, for the first image I have set widthScale and heightScale as 30 and 30, and for second I have set those scales to 50 and 50.
The issue is when I open the excel file created, both the images are not in the percentage as they should be, the first image which was 30% X 30% was changed to 40% X 40% and the second image which was 50% X 50% was changed to 67% X 67%.
Am I missing something here or is it an issue.
Below is the sample code and I am attaching the screen shot with comments of the excel file generated.
package com.asposeExe;
import java.io.InputStream;
import com.aspose.cells.Workbook;
import com.aspose.cells.Worksheet;
public class AposeExeMain {
public static void main(String[] args) throws Exception {
Workbook workbook = new Workbook();
String sheetName = “ImgSheet”;
Worksheet worksheet = workbook.getWorksheets().add(sheetName);
InputStream imgStream = AposeExeMain.class.getClassLoader().getResourceAsStream(“img-vertical.JPG”);
*worksheet.getPictures().add(0, 2, imgStream, **30** , **30** );*
imgStream = AposeExeMain.class.getClassLoader().getResourceAsStream(“img-vertical.JPG”);
*worksheet.getPictures().add(0, 6, imgStream, **50** , **50** );*
workbook.save(“ImageTest.xls”);
}
}