Currently we’re evaluating to upgrade to the latest version of Aspose.Words 17.11. With this process we’ve found some strange behavior when it comes to Shapes within GroupShapes:
1. In our template document we have a GroupShape that contains a few rectangle childShapes. We try to insert an image into a childShape. When we try to manipulate the childShape’s Height to get the same aspect ratio as our image, the Height is calculated correctly, but the rendered image Height is blown up.
We use this calculation: childShape.Height = childShape.Width / imageRatio
Looking at the document (DOCX format) which contains the error, These are some of the properties of the (group)Shapes. Notice that all the (group)shapes are Dml’s:
GroupShape.CoordOrigin = {X = 0 Y = 0}
GroupShape.CoordSize = {Width = 31946 Height = 20167}
GroupShape.Height = 159
GroupShape.Width = 252.55
GroupShape.MarkupLanguage = Dml
childShape.CoordOrigin = {X = 1099 Y = 1215}
childShape.CoordSize = {Width = 30847 Height = 12732}
childShape.Height = 12732
childShape.Width = 30847
childShape.MarkupLanguage = Dml
After changing the Height it gets:
childShape.CoordOrigin = {X = 1099 Y = 1215}
childShape.CoordSize = {Width = 30847 Height = 117527070}
childShape.Height = 9254.1
childShape.Width = 30847
childShape.MarkupLanguage = Dml
So it looks like the Height gets the correct value, but the CoordSize.Height is blown up. Looking at a similar document (DOC format), where the (group)shapes are Vml’s it seems to work correctly:
GroupShape.CoordOrigin = {X = 0 Y = 0}
GroupShape.CoordSize = {Width = 31946 Height = 20167}
GroupShape.Height = 159
GroupShape.Width = 252.55
GroupShape.MarkupLanguage = Vml
childShape.CoordOrigin = {X = 0 Y = 0}
childShape.CoordSize = {Width = 21600 Height = 21600}
childShape.Height = 12732
childShape.Width = 30847
childShape.MarkupLanguage = Vml
After changing the Height it gets:
childShape.CoordOrigin = {X = 0 Y = 0}
childShape.CoordSize = {Width = 21600 Height = 21600}
childShape.Height = 9254.1
childShape.Width = 30847
childShape.MarkupLanguage = Vml
In this case the CoordSize isn’t even changed.
2. The second issue is that we’ve noticed a NullReference when trying to use an InsertBefore on a GroupShape:
childShape.ParentNode.InsertBefore(newShape, childShape);
where ParentNode is a GroupShape (and ofcourse childShape and newShape both are not NULL). Again if the GroupShape is a Vml (in a DOC template) it works just fine., But when it is a Dml (in a DOCX template) we get the following StackTrace:
Object not set to an instance of an object
at Aspose.Words.Drawing.GroupShape.r3ka8zscesabkstb24kjjv9sml9wq7pw (Node )
at Aspose.Words.CompositeNode.(Node , Node , Boolean )
Can you confirm these bugs?