Forum


Replies: 1   Views: 238
Microsoft publisher - importing docx documents: issues with table cell content and strictwordstyles
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by mschill  · 01-07-2025 - 08:50

Hello,

I'm using phpdocx to generate a DOCX document from HTML that is later edited in Microsoft Publisher. Unfortunately, Publisher does not display the content of certain table cells correctly — especially when those cells contain multiple blocks or line breaks. The content sometimes disappears entirely.

To work around this, I’ve removed all <p> tags from my HTML and replaced them with <br /> and inline styles only. This helps in many cases, but not all.

I noticed that enabling strictWordStyles = true makes the document render correctly in Publisher (no missing content), but then I lose formatting options like background colors in table headers.

My questions:

  1. Is this a known issue with Publisher compatibility?

  2. Is there a way to apply strictWordStyles = trueonly to specific parts of the document, for example, only inside certain table cells?

For context, here's a simplified example of what gets generated:

Problematic output (Publisher breaks rendering):

<w:p>
  <w:pPr>
    <w:widowControl w:val="on"/>
    <w:pBdr/>
    <w:spacing w:before="105" w:after="30" w:line="379" w:lineRule="auto"/>
  </w:pPr>
  <w:r>
    <w:rPr>...</w:rPr>
    <w:t>Hl. Messe</w:t>
  </w:r>
  <w:r>
    <w:rPr>...</w:rPr>
    <w:br/>
    <w:t>nach Meinung</w:t>
  </w:r>
</w:p>

Working output in Publisher:

<w:p>
  <w:pPr>
    <w:widowControl w:val="on"/>
  </w:pPr>
  <w:r>
    <w:rPr>
      <w:b/>
    </w:rPr>
    <w:t>Hl. Messe</w:t>
  </w:r>
  <w:r>
    <w:rPr/>
    <w:br/>
    <w:t>nach Meinung</w:t>
  </w:r>
</w:p>

 

Kind regards,
Anna Krämer