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

Free Support Forum - aspose.com

Append Document throws NullPointerException

Dear ASPOSE Java Words Team,

I was trying to append one Document to another, but unfortunately a NullPointerException were thrown.

Please see below code and attached files.

I am appreciate if you can notice me, if it’s a bug or caused by other reasons ASAP.

public static void main(String[] args) {
        try {
          Document document1 = new Document("...\\doc1.docx");
          Document document2 = new Document("...\\doc2.docx");
      document1.appendDocument(document2, ImportFormatMode.KEEP_DIFFERENT_STYLES);
      document1.save("result.docx", SaveFormat.DOCX);
    } catch (Exception e) {
      e.printStackTrace();
    }

  }

docs.zip (86.9 KB)

@kzdwww,

We tested the scenario 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-19620. We will further look into the details of this problem and will keep you updated on the status of correction. We apologize for your inconvenience.

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

Ok,Thanks for your information!