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

Free Support Forum - aspose.com

Extreme slowness when merging documents in .doc format

Hi,

I noticed great slowness when merging the attached documents into a single .doc file, in the order specified by the filename.

The script operates as follows:
- loads all partial .doc files in memory
- merge them into a single document
- save the merged document back to disk

On my machine, saving to .doc requires about 45 seconds, while saving to .pdf requires less than 20 seconds.

The problem becomes much greater when the second file to be merged is about 2-3 MB in size, in that case saving to .doc required almost 30 minutes!

Found using Aspose.Words for Java 10.4, here is the merging code:

public static Document merge(Document[] documents, int sectionStart, int formatting) throws Exception {
Document merged;

if (documents.length > 1) {
merged = new Document();
merged.removeAllChildren();

for (int i = 0; i < documents.length; ++i) {
if (sectionStart == SectionStart.CONTINUOUS && i > 0) {
PageSetup ps = documents[0].getFirstSection().getPageSetup();
PageSetup tmp = documents[i].getFirstSection().getPageSetup();

tmp.setPageWidth(ps.getPageWidth());
tmp.setPageHeight(ps.getPageHeight());
tmp.setOrientation(ps.getOrientation());
tmp.setVerticalAlignment(ps.getVerticalAlignment());
}

documents[i].getFirstSection().getPageSetup().setSectionStart(sectionStart);
merged.appendDocument(documents[i], formatting);
}

if (sectionStart == SectionStart.CONTINUOUS) {
merged.getFirstSection().getBody().getFirstParagraph().getParagraphBreakFont().setSize(1.0);
}
}
else {
merged = documents[0];
}

return merged;
}

Hi Matteo,


Thanks for your inquiry.

Perhaps you’re using an older version of Aspose.Words; as with Aspose.Words for Java v13.1, I was unable to reproduce this issue on my side. I would suggest you please upgrade to the latest version of Aspose.Words i.e. v13.1. You can download it from the following link:
http://www.aspose.com/community/files/72/java-components/aspose.words-for-java/default.aspx

I hope, this helps.

Best regards,

Yes, as stated in my post above, we are currently using Aspose.Words for Java version 10.4, but we cannot upgrade right now.

Thanks for your help anyway!

Hi Matteo,


Thanks for the additional information. Well, we always encourage our customers to use the latest version of Aspose.Words as it contains newly introduced features, enhancements and fixes to the issues that are reported earlier. The 10.4.0 release of Aspose.Words is an old API and now we do not provide technical support for this version of Aspose.Words. Therefore, I would suggest you please renew your subscription to be able to use the latest released version of Aspose.Words. Please let me know if I can be of any further assistance.

Best regards,