Page 1 of 1

Bullet point lost format

PostPosted: Mon Jan 06, 2020 12:43 pm
by Johanna
I am using docx4j to remove metadata (creator, LastModifiedBy). I load the file and set new value them save using
Code: Select all
SaveToZipFile saver = new SaveToZipFile(wordMLPackage);
                saver.save(outputfilepath);


everything look fine but the bullet points are missing.

I tried installing
sudo apt-get install msttcorefonts but still bullet points missing.
When I open the file (The current fort is not available and will be substituted)

Any workaround for this? Can I get some advise how to fix it?

Re: Bullet point lost format

PostPosted: Tue Jan 07, 2020 8:44 am
by jason
Please attach input and output docx files.

Re: Bullet point lost format

PostPosted: Tue Jan 07, 2020 1:46 pm
by Johanna
Hi Jason,
Find attach the input , output files and my test code.

I tried copy the font in jdk but still same issue
sudo cp -r /usr/share/fonts/ /usr/lib/jvm/java-11-openjdk-amd64/lib

Cheers,
Johanna

Re: Bullet point lost format

PostPosted: Wed Jan 08, 2020 10:36 am
by jason
The problem here is that in your output document, the rFonts entries in numbering.xml differ from the input document.

For example,

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  <w:abstractNum w:abstractNumId="2">
    <w:lvl w:ilvl="0">
:
      <w:rPr>
        <w:rFonts w:ascii="Symbol" w:hAnsi="Symbol" w:cs="Symbol" w:hint="default"/>
        <w:sz w:val="21"/>
        <w:szCs w:val="21"/>
        <w:rFonts w:cs="Symbol"/>
      </w:rPr>
    </w:lvl>
 
Parsed in 0.001 seconds, using GeSHi 1.0.8.4


is becoming

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
    <w:abstractNum w:abstractNumId="2">
        <w:lvl w:ilvl="0">
:
            <w:rPr>
                <w:rFonts w:cs="Symbol"/>
                <w:sz w:val="21"/>
                <w:szCs w:val="21"/>
            </w:rPr>
        </w:lvl>

 
Parsed in 0.001 seconds, using GeSHi 1.0.8.4


If you look closely, you'll see that the problem is that the input docx contains 2 rFonts elements within w:rPr, when there should only be 1. When the second element is encountered, it overwrites the first. It took me a while to notice that :-(

So you should ensure your input docx does not contains such duplicates. The Open XML SDK Productivity Tools' Validate feature seems to pick up these issues; you also have duplicate Bold elements in your main document part.

It would be interesting to know what app last saved this docx. Was that LibreOffice 6.0.7.3 (per its app.xml), or something else?