void Copy (WorkBook book) { WorkSheet sheet1 = book.WrokSheets [0]; WorkSheet sheet2 = book.WrokSheets [1]; WorkSheetShape shape = sheet1.Shapes [0]; sheet2.Shapes.Add (shape); / / exception } How to add shape to sheet2?
For me it worked like this:
foreach (WorksheetImage shapeSource in sourceWorksheet.Shapes) { WorksheetImage shapeDestination = new WorksheetImage(shapeSource.Image); shapeDestination.Outline = shapeSource.Outline; shapeDestination.TopLeftCornerCell = GetSameCellInOtherWorksheet(shapeSource.TopLeftCornerCell, destination); shapeDestination.TopLeftCornerPosition = shapeSource.TopLeftCornerPosition; shapeDestination.BottomRightCornerCell = GetSameCellInOtherWorksheet(shapeSource.BottomRightCornerCell, destination); shapeDestination.BottomRightCornerPosition = shapeSource.BottomRightCornerPosition; shapeDestination.PositioningMode = shapeSource.PositioningMode; destination.Shapes.Add(shapeDestination); }
static WorksheetCell GetSameCellInOtherWorksheet(WorksheetCell sourceCell, Worksheet destinationWorksheet) { return destinationWorksheet.Rows[sourceCell.RowIndex].Cells[sourceCell.ColumnIndex]; }
Hi Vladimir,
I have sent your feature request directly to our product management team on your behalf. Our product team chooses new feature requests for development based on popular feedback from our customer base. Infragistics continues to monitor application development for all of our products, so as trends appear in requested features, we can plan accordingly.
We value your input, and our philosophy is to enhance our toolset based on customer feedback. If your feature is chosen for development, you will be notified at that time. Your reference number for this feature request is FR14056.
If you would like to follow up on your feature request at a later point, you may contact Developer Support management via email. Please include the reference number of your feature request in the subject and body of your email message. You can reach Developer Support management through the following email address: dsmanager@infragistics.com
Thank you for your request.
Sincerely,
Chris K
Developer Support Engineer
Infragistics, Inc.
www.infragistics.com/support
There is currently no way to add a shape to another worksheet or to clone it. You can submit a feature request for the ability to clone a shape.