Page 1 of 1

Unable to get Bullet style for the unordered List items

PostPosted: Sun Aug 02, 2015 1:45 am
by Lokesh
Hi All,

Am started using docx4j for my html to docx conversion,
Using docx4j 3.1.0 and docx4j ImportXHTML 3.0.1,

with the above jars am unabe to get my unordered list items as bulleted list,
it allways generates decimal numbered format ( irrespective of <ol> or <ul> ), even after applying "ListParagraph" pStyle
and tried multiple times with different NumId's for the numPr respective to the abstract Num definition which
has "bullet" num_fmt.

Even tried to set the modified numbering.xml into NumberingDefinitionsPart insteda of using unmarshalDefaultNumbering
but whatever the case it ends with same numbering.xml after conversion.

Also tried in modifying the ListHelper by hardcoding num_fmt to BULLET in addNumbering() method, still no impact.

Can some one please help me to figure the reason behind.

Regards,
Lokesh

Re: Unable to get Bullet style for the unordered List items

PostPosted: Mon Aug 03, 2015 12:00 am
by jason
Put @class on the ol or ul, with value corresponding to the list style you want.

See https://github.com/plutext/docx4j-Impor ... java#L1059

and generally, https://github.com/plutext/docx4j-Impor ... elper.java

Re: Unable to get Bullet style for the unordered List items

PostPosted: Mon Aug 03, 2015 8:45 pm
by Lokesh
Hi Jason,

Thanks for the quick reply,

I tried by adding the class to lists ( ol /ul ) still no change in my output am seeing same decimal numbering for all list items.

I tried using class="ListParagraph" or "BulletList" but not getting any bullet format,
neither i see these styles in document.xml or styles.xml or numbering.xml.

how can i find what inbuilt bullet/list styles available,
also how can we add a new style and use it.

Regards,
Lokesh

Re: Unable to get Bullet style for the unordered List items

PostPosted: Mon Aug 03, 2015 11:43 pm
by jason
What FormattingOption have you got set for setParagraphFormatting?

You need to have the style you specify in @class defined in your docx styles part. None are defined elsewhere.

Alternatively, don't use @class; instead define list style attributes via @style. See the source code linked in my previous post for how these are used (eg https://github.com/plutext/docx4j-Impor ... .java#L191 ff)

Re: Unable to get Bullet style for the unordered List items

PostPosted: Fri Aug 07, 2015 7:48 pm
by Lokesh
Thank u jason,

Got it by activating few styles from knownStyles using PropertyResolver.