Page 1 of 1

Template with merged cells

PostPosted: Tue Aug 29, 2017 2:16 am
by Kekwel
Hi !

I have encountered a problem and I would like some help or advices about it.

So, I have a docx template, with variables to replace and a table. You can see them in the attachment.

The variable replacement work fine, but my problem is with table and cells, as you can see in the pdf file.
The columns aren't the same as in the template.

I am using the dependencies 3.3.2 of dox4j and 3.3.0 of docx4j-export-fo
Here is the code I'm using for generate the PDF
Code: Select all
public static void convert(WordprocessingMLPackage wordMLPackage, String inputfilepath) {
      try {
         Mapper fontMapper = new IdentityPlusMapper();

         PhysicalFont font = PhysicalFonts.get("Arial Unicode MS");
         if (font != null) {
            fontMapper.put("Times New Roman", font);
            fontMapper.put("Arial", font);
         }
         fontMapper.put("Libian SC Regular", PhysicalFonts.get("SimSun"));

         wordMLPackage.setFontMapper(fontMapper);

         String outputfilepath;
         if (inputfilepath == null) {
            outputfilepath = System.getProperty("user.dir") + "/simpleDoc.pdf";
         } else {
            outputfilepath = inputfilepath + ".pdf";
            System.err.println(" ** " + outputfilepath);
         }

         OutputStream os = new java.io.FileOutputStream(outputfilepath);

         Docx4J.toPDF(wordMLPackage, os);

         if (wordMLPackage.getMainDocumentPart().getFontTablePart() != null) {
            wordMLPackage.getMainDocumentPart().getFontTablePart().deleteEmbeddedFontTempFiles();
         }

         wordMLPackage = null;
         os.close();
      } catch (Exception e) {
         e.printStackTrace();
      }
   }


I looked at the document.xml of the template but didn't see something missing or strange.

Is this an known issue or do I missed something ?