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

Free Support Forum - aspose.com

Mail Merge and Optimize PDF Output for old MS Word 2010 (Java) | Paragraph Shading Color

Hello,
We are encountering additional formatting issues when we upgraded Aspose - from 15.5 to 21.4 recently and the documents have below listed problems when generated to PDF.

  1. Empty blue bar.
  2. Half of the grid is missing.
  3. space between the grids.
    sample project_15.5.png (46.3 KB)
    sample project-21.4.png (58.2 KB)

I have created two projects with related versions which generates PDFs as we do it in our app. The template and steps are same. Both using minimalTemplate.docx which is in zip
aspose project services.zip (880.3 KB)

The template is working fine in 15.5 but it causing the issue in 21.4.

We would like to ask you what changed or what we do wrong/ need to change in order to make it work. We would like to have some workaround instead of changing it in every template.

Thank you

@jcash_casenetllc_com,

I am afraid, we could not locate the source template Word document “minimalTemplate.docx” inside the “aspose project services.zip” archive that you attached in previous post. Also, please upgrade to the latest (21.7) version of Aspose.Words for Java and see how it goes on your end? In case the problem still remains, then can you please reattach source Word template file here for testing?

Hi @awais.hafeez,

Both Aspose 15.5 and 21.4 using the minimalTemplate.docx which is in attached zip

aspose project services.zip (933.7 KB)

Thank you

@jcash_casenetllc_com,

This bar is even present in “output1505.docx” and “output1505Result.docx” documents. When you convert these Word documents to PDF formats manually by using “Save As” command of MS Word 2019, then you will notice that MS Word renders this blue bar in output PDFs which is similar to what latest versions of Aspose.Words produce. So, this seems to be a bug in old version of Aspose.Words for Java.

Can you please provide comparison screenshots highlighting (encircle) the above mentioned problematic area(s) in Aspose.Words 21.7 generated output and attach them here for our reference? We will then investigate these issues further and provide you more information.

Empty blue bar::
It works fine in the Aspose version15.5. No issue for this version. The doc file contains the template. It is generating the PDF file correctly in Aspose 15.5.

Bu,t it not working fine in 21.4. Please check the generated PDF file.
So, this seems to be a bug in 21.4 version of Aspose.Words for Java.

Please let us know if you need zoom sessions to discuss on this issue.

Thank you.

@jcash_casenetllc_com,

Please check these files: Template and output PDF files.zip (227.6 KB)

  • minimalTemplate.docx - When you open this file with MS Word 2019, you will notice MS Word 2019 displays that blue paragraph shading color in its editor.
  • minimalTemplate - ms word 2019.pdf - This file was produced by using “File | Save As” command of MS Word 2019. The blue shading color also appears at the end of this MS Word 2019 generated PDF.
  • minimalTemplate - aspsoe.words 21.7.pdf - This file was produced by using the following simple code of latest 21.7 version of Aspose.Words for Java. Again, the blue shading color appears in this PDF. In this case, the latest 21.7 version mimics the behavior of MS Word 2019.
  • minimalTemplate - aspsoe.words 15.5.0.pdf - This file was also produced by using the following simple code of old 15.5.0 version of Aspose.Words for Java. But unlike the above two PDFs, the blue shading color is not visible in this PDF. Most likely because of a bug or a missing feature, in this case, the old 15.5.0 version does not mimic the behavior of MS Word 2019.
License lic = new License();
lic.setLicense("Aspose.Words.Java.lic");
Document doc = new Document("minimalTemplate.docx");
doc.save("output.pdf");

However, if you don’t want to see the empty blue bar in the PDF output produced by latest 21.7 version of Aspose.Words, then you may want to optimize for MS Word 2010.

public void generateDoc() throws Exception {

    List<String> empty = new ArrayList<String>();

    Document doc = new Document(fileTemplate);
    doc.getCompatibilityOptions().optimizeFor(MsWordVersion.WORD_2010);

    MailMerge mailMerge = doc.getMailMerge();
    mailMerge.setUnconditionalMergeFieldsAndRegions(true);
...
...