Free Support Forum - aspose.com

[Bug(s)] Manipulating shape in GroupShape & GroupShape.InsertBefore


#1

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?


#2

@hro_jordy1,

To ensure a timely and accurate response, please ZIP and upload the following resources for your two different scenarios here for testing:

  • Your input Word documents.
  • Aspose.Words for .NET 17.11 generated output documents (if any) which show the undesired behaviors.
  • Please attach your expected document(s) here for our reference. We will investigate the structure of your expected document(s) as to how you want your final outputs be generated like. You can create expected document(s) by using Microsoft Word.
  • Please create standalone Console Applications (source code without compilation errors) that helps us to reproduce your problems on our end and attach them here for testing.
  • Please provide information about the Aspose.Words’ version number for which there were no problems on your side previously.

As soon as you get these pieces of information ready, we’ll start investigation into your issue and provide you more information. Thanks for your cooperation.


#3

@awais.hafeez I was hoping to skip the creation of sample projects by providing enough information :wink: But I’ve created a zip-file with the requested information.

For each scenario I’ve created duplicate code and documents (DOCX and DOC format) to see the change in output.

Scenario 01: As you can see in the output DOCX the shape is vertically way to large. In the output DOC the shape is how it should be, but we want the same result also in the DOCX file.

Scenario 02: There is no DOCX output as the InsertBefore generates an error (see the catch message). The DOC file is generated as the code does not throw an error.

Aspose bug(s).zip (206.1 KB)


#4

@hro_jordy1,

We are checking these scenarios and will get back to you soon.


#5

Hi @awais.hafeez,

It’s been a few days now, can you confirm the bugs at your end?


#6

@hro_jordy1,

We tested the Scenario 01 and have managed to reproduce the same problem on our end. For the sake of correction, we have logged this problem in our issue tracking system. The ID of this issue is WORDSNET-16239.Our product team will further look into the details of this problem and we will keep you updated on the status of correction. We apologize for your inconvenience.


#7

@hro_jordy1,

We tested the Scenario 02 and have managed to reproduce the same problem on our end. For the sake of correction, we have logged this problem in our issue tracking system. The ID of this issue is WORDSNET-16240.Our product team will further look into the details of this problem and we will keep you updated on the status of correction. We apologize for your inconvenience.


#8

The issues you have found earlier (filed as WORDSNET-16239) have been fixed in this Aspose.Words for .NET 18.3 update and this Aspose.Words for Java 18.3 update.


#9

Hi @awais.hafeez,

Thanks for fixing the first issue (we still need to confirm that it fixes our issue, but I’m confident that it does). I’m also tracking the second issue, which went from ‘In Review’ to ‘Postponed’. Because we want to upgrade to the new Aspose version, and these issues needs to be resolved, I would like to know if the second issue will be fixed. Could you elaborate why the issue is postponed?


#10

@hro_jordy,

Regarding WORDSNET-16240, the implementation of the fix of this issue has been postponed till a later date (currently no estimates are available). We will inform you via this thread as soon as this issue is resolved or any estimates are available. We apologize for any inconvenience.


#11

Hi @awais.hafeez,

After 6 months is the fix for the second bug still on your roadmap?


#12

@hro_jordy,

Unfortunately, your issue (WORDSNET-16240) is not resolved yet and there is no further news about it i.e. the implementation of the fix of this issue has still been postponed. We can currently not share any estimates with you either. We will inform you via this thread as soon as this issue is resolved or any estimates are available. We apologize for your inconvenience.


#13

Hi @awais.hafeez,

Thank you for you ‘generic’ reply. Because this bug forces us not to update to the latest version and still use old formats (DOC files, DOCX with compatibility mode) we would like to know if there’s a workaround for this bug so we can use the normal DOCX format?


#14

@hro_jordy,

We have logged your concern in our issue tracking system and will let you know via this thread as soon as any further update or workaround is available. We apologize for your inconvenience.


#15

@hro_jordy,

Regarding WORDSNET-16240, it is to update you that the solution for this problem is being developed. Rough estimate is Aspsoe.Words’ 19.3 March release. Please note that this estimate is not final at the moment. If everything goes by plan, then we will include this fix in 19.3 version. We will inform you via this thread as soon as this issue is resolved. Thanks for being patient.