Skip to content

Commit

Permalink
Allowed for save of groups containing drawings with same name (#902)
Browse files Browse the repository at this point in the history
  • Loading branch information
OssianEPPlus committed Jun 9, 2023
1 parent 530694f commit 83e33c3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/EPPlus/Drawing/ExcelGroupShape.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ private void AddDrawings()
{
var grpDraw = ExcelDrawing.GetDrawingFromNode(_parent._drawings, node, (XmlElement)node, _parent);
_groupDrawings.Add(grpDraw);
_drawingNames.Add(grpDraw.Name, _groupDrawings.Count - 1);
if (_drawingNames.ContainsKey(grpDraw.Name) == false)
{
_drawingNames.Add(grpDraw.Name, _groupDrawings.Count - 1);
}
}
}
}
Expand Down
12 changes: 12 additions & 0 deletions src/EPPlusTest/Issues.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4902,6 +4902,18 @@ public void s466()
}
}
[TestMethod]
public void i898()
{
using (var package = OpenTemplatePackage("i898DoubleGroup.xlsx"))
{
var sheet = package.Workbook.Worksheets[0];

sheet.Cells["A1"].Value = 1;

//Ensure saving of drawings with same name when read from file is possible
SaveAndCleanup(package);
}
}
public void s473()
{
using (var p = OpenPackage("tableCopyTest.xlsx", true))
Expand Down

0 comments on commit 83e33c3

Please sign in to comment.