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

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 (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


I am afraid, we could not locate the source template Word document “minimalTemplate.docx” inside the “aspose project” 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 (933.7 KB)

Thank you


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.


Please check these files: Template and output PDF (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 - Aspose.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 - Aspose.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();
Document doc = new Document("minimalTemplate.docx");"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);

    MailMerge mailMerge = doc.getMailMerge();