Page 1 of 1

Expected DefaultParagraphFont to have <w:basedOn ??

PostPosted: Mon Oct 22, 2012 8:37 pm
by BarbioTim
Hi,

Can anyone tell me why this error is being thrown?
In the code we found when it's thrown, but in our docx we don't see what could be wrong.
The pdf is however generated without problems.

Tim

Re: Expected DefaultParagraphFont to have <w:basedOn ??

PostPosted: Tue Oct 23, 2012 4:21 am
by jason
An error is being logged, but nothing is being thrown, is it?

The code in question is:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
        // Now, recursively check that what it is based on is present
        boolean result1;
        if (s.getBasedOn()!=null) {
                String basedOn = s.getBasedOn().getVal();
                result1 = activateStyle( basedOn );
               
        } else if ( s.getStyleId().equals(defaultParagraphStyleId)
                        || s.getStyleId().equals(defaultCharacterStyleId) )
        {
                // stop condition
                result1 = true;
        } else {
               
                log.error("Expected " + s.getStyleId() + " to have <w:basedOn ??");
                // Not properly activated
                result1 = false;
        }
 
Parsed in 0.016 seconds, using GeSHi 1.0.8.4


If the docx was created in Word, defaultCharacterStyleId should generally equal "DefaultParagraphFont", and this message shouldn't be logged.

How was the docx in question created? What locale?

It'd be interesting if you could post a short sample docx exhibiting the issue (you can delete all content except for a bit of text, I would think).

cheers .. Jason

Re: Expected DefaultParagraphFont to have <w:basedOn ??

PostPosted: Tue Oct 23, 2012 5:15 pm
by BarbioTim
Jason,

Here you have a sample template we use.
The docx was created in Word and changing the language didn't seem to solve the problem.

Thanks,

Tim

Re: Expected DefaultParagraphFont to have <w:basedOn ??

PostPosted: Tue Oct 23, 2012 6:56 pm
by jason
In your docx, the default character style is:

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  <w:style w:type="character" w:default="1" w:styleId="Standaardalinea-lettertype">
    <w:name w:val="Default Paragraph Font"/>
    <w:uiPriority w:val="1"/>
    <w:semiHidden/>
    <w:unhideWhenUsed/>
  </w:style>
 
Parsed in 0.001 seconds, using GeSHi 1.0.8.4


This is correctly detected:

INFO org.docx4j.openpackaging.parts.WordprocessingML.StyleDefinitionsPart .getDefaultStyle line 348 - Style with name Default Paragraph Font, id 'Standaardalinea-lettertype' is default character style

What do I need to do to replicate what you are seeing?

Re: Expected DefaultParagraphFont to have <w:basedOn ??

PostPosted: Tue Oct 23, 2012 7:04 pm
by BarbioTim
I don't know :)
We see the pdf correctly but get the error in our error mailbox.
We could also just ignore it, but perhaps it's better to see where it comes from.

Can you create a pdf based on the docx provided without the error?
Even without data to replace the mergefields?