We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Issue with aspose words upgrade

While upgrading aspose words from 14.11.0 to 15.12.0 we encountered:

unable to resolve class DrawingML
@ line 1579, column 3.
for (DrawingML dml : (Iterable) dmlShapes){

where we have used DrawingML.

What is the updated class for this or suggest me what chnages should I do to work this?

Thanks,

@HThagunna,

Thanks for your inquiry. Please note that we removed the DrawingML from the Aspose.Words API. Please read the public API changes from here:
Public API Changes in Aspose.Words 15.2.0

Please use Shape instead of DrawingML in your code. Please read about migrating from earlier versions of Aspose.Words from here:
Migrating from Earlier Versions of Aspose.Words

Best Regards,
Tahir Manzoor

Thanks for your reply.

I have the code like this.

 NodeCollection dmlShapes = main_src.getChildNodes(NodeType.DRAWING_ML, true);
 for (DrawingML dml : (Iterable<DrawingML>) dmlShapes){
      if (dml.hasImage()){
           imageMergeFields?.each{key,val->
                if(val == dml.getAlternativeText()){
                     InputStream is = new FileInputStream(new File(chartCollection?.getAt(key)))
                     dml.imageData.setImage(is)
                }
           }
      }

This part is not working right now after the upgrade. What should I replace this with?

Thanks,

@HThagunna,

Thanks for your inquiry. Please check the following code snippet.

NodeCollection dmlShapes = main_src.getChildNodes(NodeType.SHAPE, true);
for (Shape dml : (Iterable<Shape>) dmlShapes){
if (dml.hasImage()){
     
    }
}

Best Regards,
Tahir Manzoor

Thanks for your reply.

We are still facing a problem while generating a document with the PNG images. Could somebody guide us what is wrong here? Also looking into official site, it says that the png image format is supported.

Following is the code:

String filename = “image.png”;
NodeCollection shapes = document.getChildNodes(NodeType.SHAPE, true);
for (Shape shape : shapes){
if (shape.hasImage()){
InputStream is = new FileInputStream(new File(filename)));
shape.getImageData().setImage(is);
}
}

LOG:
Caused by: java.lang.IllegalArgumentException: The image format is not supported. FileFormat=UNKNOWN
at asposewobfuscated.zzMS.zzT(Unknown Source)
at asposewobfuscated.zzMS.(Unknown Source)
at com.aspose.words.zzZTH.zzZD(Unknown Source)
at com.aspose.words.zzZTH.zzC(Unknown Source)
at com.aspose.words.zzZTH.setImageBytes(Unknown Source)
at com.aspose.words.zzZTH.zz4(Unknown Source)
at com.aspose.words.ImageData.zz4(Unknown Source)
at com.aspose.words.ImageData.setImage(Unknown Source)
at com.aspose.words.ImageData$setImage.call(Unknown Source)

Thanks in Advance.

@HThagunna,

Thanks for your inquiry. Please upgrade to the latest version of Aspose.Words for Java 17.7. If you still face problem, please share your input document and image here for testing. We will investigate the issue and provide you more information on this.

Best Regards,
Tahir Manzoor