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

Free Support Forum - aspose.com

Include multiples word documents into zip aspose

Hello,
How can I download a list of documents wrapped into a zip file ?

Thanks in advance

Alex

Hi Alex,

Thanks for your inquiry. Unfortunately, your question isn’t clear enough therefore we request you to please elaborate your inquiry further by providing complete details of your use-case and mentioning the Aspose product(s) that you are currently using. This will help us to understand your scenario, and we will be in a better position to address your concerns accordingly.

Best regards,

Hi,
this is my code:

Document dstDoc = null;
for (DatasetBean dataset : listaDS)
{
    Document doc = DocxUtility.getDocument(< path_word_template >);
    doc.getMailMerge().setCleanupOptions(MailMergeCleanupOptions.REMOVE_UNUSED_FIELDS);
    doc.getMailMerge().execute(
    new String[] {
        "field_1",
        "field_2",
        "field_3",
        …
        "field_N"
    },
    new Object[] {
        dataset.getField1(),
        dataset.getField2(),
        dataset.getField3(),
        … 
        dataset.getFieldN()
    }
    );
    // Insert srcDoc to dstDoc
    if (dstDoc == null)
    {
        dstDoc = doc;
    }
    else
    {
        dstDoc.appendDocument(doc, portFormatMode.KEEP_SOURCE_FORMATTING);
    }
}
dstDoc.save("<path_for_save> " + "test_f24.docx");

For each item in listaDS I generate a word document from template (with mergefields) and I append it to the previuos, but when I save the complete document (dstDoc, it is possible that it is made up of 500 pages) I obtain OutOfMemoryError (java heap space).

Possible solutions:

  1. Increase server heap memory (Tomcat 7 in my case) ?
  2. dstDoc.save --> Is there a PARTIAL Save ?

I hope I have clarified the problem better

Alex

Hi Alex,

Thanks for your inquiry. I think, you can split this big document into Sections or Pages and then rejoin required pages into smaller documents such that each sub document contains 500 pages.

The following example can be used to split the document into sections so that each page begins and ends at a section boundary. It is recommended not to modify the document afterwards. Hope, this helps.

Split Word Document into Pages by using Aspose.Words for Java

Best regards,