Docx generated using content control not compatible with libre office

I have a document generating api in C# that fills the word template created using content controls. (literal, pics and altchunk). The api used is open office xml sdk 2.0. It works fine when i open in ms word 2007+. However it doesn’t display any content controls text when opened in libre office. I am using libreoffice to convert word document to pdf.

Any idea what can be done to fix this issue?

Don’t know the answer, but here are some details: You can use databinding to add actual value to placeholder elements. LibreOffice only displays the databindable element’s placeholder text.

Here is an article about how to do it.

And here is a sample docx: ContentControls.docx.odt (it is a docx, ignore the extension. Just can’t upload files with docx extension for some reason) that contains a content control. Word shows “data from databinding”, as set in the data-source xml, but libreoffice (checked with only shows the placeholder text.

The data used for databinding, if someone doesn’t have that Content Control Toolkit:

  <something>data from databinding</something>

The element in the document:

    <w:dataBinding w:xpath="/root[1]/something[1]" w:storeItemID="{4eca48a1-5a98-425b-a2ec-98e9f57ae606}" />
    <w:alias w:val="titleOfFirstElement" />
    <w:tag w:val="tagOfFirstElement" />
    <w:id w:val="-1614272614" />
      <w:docPart w:val="DefaultPlaceholder_1082065158" />
    <w:p w:rsidR="00570B6E" w:rsidRDefault="00570B6E">
        <w:t>placeholder text</w:t>

@AkosLukacs – You should now have enough karma to upload files :slight_smile:

@qubit1 - thanks.

@AkosLukacs – Regarding DOCX upload, see fdo#52553 - ASKLIBREOFFICE Allowed filetypes for upload too restrictive.

I have a simple text “my name is jack Thomas” in ms word. If you view in libre office writer it wont display “jack Thomas” The text jack Thomas is databound to xml in content control placeholder.

How do I get this document to view correctly in libreoffice.
Sorry I cannot attach the document as it needs karma > 3.

Here are the steps

  1. Open blank word document in 2007+.
  2. Add content control placeholder
  3. Go to content control tool kit and map content control with text
  4. Open word document to verify that the text is there.

You should have enough karma now. Please attach your example for others to verify in Writer.

I will appreciate if someone reply to this?

Hi @Mac,

It’s a little unclear to me what you’re doing in C# – are you generating a template file, or just filling in a template file? You mention your API as ‘open office xml sdk 2.0’, but your title suggest that you’re using Microsoft’s .docx format. Do you mean ‘Office Open XML’ instead?

In any case, if you could upload a copy of the files you’re working with, that would be most helpful. We can take a look at how the files render under LO as well as MS-Office.