> Last version tested: 4.0.4
> Last version with bug: 4.0.4
I just found a solution to clone shapes from one file to another.
Just add this to your ExcelDrawings.cs
```C#
/// <summary>
/// Add a new shape to the worksheet
/// </summary>
/// <param name="Name">Name</param>
/// <param name="Source">Source shape</param>
/// <returns>The shape object</returns>
public ExcelShape AddShape(string Name, ExcelShape Source)
{
if (Worksheet is ExcelChartsheet && _drawings.Count > 0)
{
throw new InvalidOperationException("Chart worksheets can't have more than one drawing");
}
if (_drawingNames.ContainsKey(Name))
{
throw new Exception("Name already exists in the drawings collection");
}
XmlElement drawNode = CreateDrawingXml();
drawNode.InnerXml = Source.TopNode.InnerXml;
ExcelShape shape = new ExcelShape(this, drawNode);
shape.Name = Name;
shape.Style = Source.Style;
_drawings.Add(shape);
_drawingNames.Add(Name, _drawings.Count - 1);
return shape;
}
```
Please add this to one of the next realeases.
Thank you.
Comments: Fixed in changeset 65115680ca04
> Last version with bug: 4.0.4
I just found a solution to clone shapes from one file to another.
Just add this to your ExcelDrawings.cs
```C#
/// <summary>
/// Add a new shape to the worksheet
/// </summary>
/// <param name="Name">Name</param>
/// <param name="Source">Source shape</param>
/// <returns>The shape object</returns>
public ExcelShape AddShape(string Name, ExcelShape Source)
{
if (Worksheet is ExcelChartsheet && _drawings.Count > 0)
{
throw new InvalidOperationException("Chart worksheets can't have more than one drawing");
}
if (_drawingNames.ContainsKey(Name))
{
throw new Exception("Name already exists in the drawings collection");
}
XmlElement drawNode = CreateDrawingXml();
drawNode.InnerXml = Source.TopNode.InnerXml;
ExcelShape shape = new ExcelShape(this, drawNode);
shape.Name = Name;
shape.Style = Source.Style;
_drawings.Add(shape);
_drawingNames.Add(Name, _drawings.Count - 1);
return shape;
}
```
Please add this to one of the next realeases.
Thank you.
Comments: Fixed in changeset 65115680ca04