We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Image size

Hello,

I inserted two pictures into my Excel file. These images have very similar size and the same resolution. But in Excel they look very different.

I tried to change size of image but it did no have any effect to Excel or I even got worst result. Image smaller than second image looks like it is bigger.

How I can control size of image? Or maybe I can re-size it to be sure that it always will fit into necessary space?

Regards,
Sergey Roznikov.

Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for considering Aspose.

Well, I am not very clear about your problem. Can you please provide a bit more detail or share your image files and the code snippet, so we can better understand the issue,

For simple image insertion, I have taken two different images and inserted them in an excel file and they seem to work ok. Following is my sample code and attached is my resultant file.

Sample Code:

Workbook workbook = new Workbook();

//Get the first sheet.

Worksheet sheet = workbook.Worksheets[0];

//Get an image file to the stream.

FileStream stream = new FileStream("c:\\school.JPG",FileMode.Open,FileAccess.Read);

//Add a new picture to the sheet

int i = sheet.Pictures.Add(2, 3,6, 5, "c:\\logo.jpg");

i = sheet.Pictures.Add(7, 8, 11, 10, stream);

//Save the excel file.

workbook.Save("C:\\tstpictures.xls");

I used two different over loaded Picture.Add() methods and there are certain other overloads of Picture.Add() method, which you can see in the following link and use them according to your need.

http://www.aspose.com/documentation/file-format-components/aspose.cells-for-.net-and-java/aspose.cells.pictures.add_overloads.html

Thank You & Best Regards,