What is the best way to copy a shape (picture) from one sheet to another?
Hi,
Well, it's very simple, please see the following sample code:
Sample code:
Workbook workbook = new Workbook();
workbook.Open(@"F:\test\PicBook.xls");
//Get the picture in the first worksheet.
Picture source = workbook.Worksheets[0].Pictures[0];
//Get the picture into memory stream
MemoryStream ms = new MemoryStream(source.Data);
//Copy it into the second sheet in the same workbook.
workbook.Worksheets[1].Pictures.Add(source.UpperLeftRow, source.UpperLeftColumn, ms, source.WidthScale, source.HeightScale);
workbook.Save(@"F:\test\outPicBook.xls");
Thank you.