Resizing DrawingML

Hi,

I have got a problem with set new value of height and width for existing DrawingML object. I’m trying to set new value of height with following simple code:

Document doc = new Document("D:\\tmp\\1.docx");
NodeCollection<?> shapes = doc.getChildNodes(NodeType.DRAWING_ML, true);
for (int i = 0; i < shapes.getCount(); i++)
{
    DrawingML drawing = (DrawingML)shapes.get(i);
    drawing.setHeight(300);
}
doc.save("D:\\tmp\\2.docx");

After opening 2.docx the height of image in 2.docx seems to be unchanged, but when I drag the image (or change some properties of this image) the height will be changed to 300. Why in 2.docx the new value of height is not updated?
Regards and thank you in advance.

Hi there,

Thanks for your inquiry.

I have tested the scenario and have managed to reproduce the same issue at my side. For the sake of correction, I have logged this problem in our issue tracking system as WORDSNET-9835. I have linked this forum thread to the same issue and you will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

Hi Tahir,

Thank you for response. Generally it is our first project in Aspose.Word (we are using commercial Developer OEM license). The goal of this project is quite simple: generating one-sheet docx document what is generated from template, in finall document we have to replace image to a new one. The new one image has got different dimensions, so we have to use setHeight() and setWidth() methods. Thank you for reporting a new issue in tracking system. I would like to ask how long can take process of resolving this issue? Maybe there are some workarounds for this issue?
If you have some update about this issue please let me know.
Thank you for your help.

Hi there,

Thanks for your inquiry. Unfortunately, there is no workaround available for this issue. I would like to share with you that issues are addressed and resolved based on first come first serve basis. Currently, your issue is pending for analysis and is in the queue. We will update you via this forum thread once there is any update available on your issue.

Thank you for your patience and understanding.

Hi Tahir,

Could you roughly estimate when this issue will be rosolved? I’m asking because we can’t finish our project because of this issue.
Thank you in advance and have a nice day.

Hi there,

Thanks for your inquiry. I am afraid this issue has now been postponed till a later date due to some other important issues and new features. We will inform you as soon as there are any further developments. We apologize for your inconvenience.

Please try the following workaround at your side. Hope this helps you.

Document doc = new Document(MyDir + "drawingML.docx");
DocumentBuilder builder = new DocumentBuilder(doc);
for (DrawingML dml : (Iterable<DrawingML>)doc.getChildNodes(NodeType.DRAWING_ML, true))
{
    ByteArrayOutputStream dstStream = new ByteArrayOutputStream();
    dml.getShapeRenderer().save(dstStream, new ImageSaveOptions(SaveFormat.PNG));
    ByteArrayInputStream srcStream = new ByteArrayInputStream(dstStream.toByteArray());
    Shape shape = builder.insertImage(srcStream);
    shape.setHeight(300);
    dml.remove();
}
doc.save(MyDir + "Out.docx");

The issues you have found earlier (filed as WORDSNET-9835) have been fixed in this .NET update and this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.