Spire.XLS is a professional Excel API that enables developers to create, manage, manipulate, convert and print Excel worksheets. Get free and professional technical support for Spire.XLS for .NET, Java, Android, C++, Python.

Fri Feb 06, 2015 5:42 pm

hi,
I have to put on one excel sheet many images.
I want to indicate the height of each image and the system should calculate the width automatically. I can?
how can I specify the row height of the excel sheet so that they are as high as the pictures?

with best regards

Rossato Luca Giovanni

lucagiovanni
 
Posts: 12
Joined: Thu Aug 14, 2014 6:59 am

Mon Feb 09, 2015 2:26 am

Dear lucagiovanni,

Sorry for the delay in posting a reply.

For your requirement, please refer to the code below:
Code: Select all
Workbook wb = new Workbook();
Worksheet ws = wb.Worksheets[0];

Image img = Image.FromFile("02.png");

CellRange range = ws.Range["A1"];
//Spire.Xls measured the row height with points, not pixels, so I make a conversion here
range.RowHeight = img.Height * 141 / 188;
ws.Pictures.Add(1, 1, img);
wb.SaveToFile("Sample.xlsx", ExcelVersion.Version2010);
Best Regards,
Burning
E-iceblue Support Team
User avatar

burning.liu
 
Posts: 406
Joined: Mon Aug 04, 2014 6:47 am

Fri Feb 13, 2015 10:44 am

hi,
thanks a lot for the answer, it works as required.

with best regards

Rossato Luca Giovanni

lucagiovanni
 
Posts: 12
Joined: Thu Aug 14, 2014 6:59 am

Wed Feb 18, 2015 2:30 am

Dear lucagiovanni,

Please feel free to contact us if you have any questions.
Best Regards,
Burning
E-iceblue Support Team
User avatar

burning.liu
 
Posts: 406
Joined: Mon Aug 04, 2014 6:47 am

Return to Spire.XLS