Hi support team.
I have a picture in a xl sheet. I need to get the position left, top of the picture and i need to add the same picture in another sheet at same position. Please give me .net code.
Example: logo.png is in sheet 1.
I need to place the logo.png in sheet 2 sheet 3 ..... sheet N in the same position.
It will be great if you could provide me the solution ASAP I have a dead line Friday.
Thanks in advance.
Regards,
Kamesh
Hi,
Please see the sample code for your reference on how to copy a picture from one sheet to place it on the second sheet on the same location with its size. I have also attached the input and output files here for your reference.
Sample code:
//Create a workbook object
//Open the template file
Workbook workbook = new Workbook(@“e:\test2\BookShapes.xlsx”);
//Get the Picture from the first worksheet.
Aspose.Cells.Drawing.Picture source = workbook.Worksheets[“Sheet1”].Pictures[0];
//Save Picture to Memory Stream
MemoryStream ms = new MemoryStream(source.Data);
//Copy the picture to the second Worksheet
workbook.Worksheets[“Sheet2”].Pictures.Add(source.UpperLeftRow, source.UpperLeftColumn, ms, source.WidthScale, source.HeightScale);
//Save the Worksheet
workbook.Save(@“e:\test2\outBookShapes.xlsx”);
Thank you.