draco1023 / poi-tl-ext

Extensions for poi-tl
Apache License 2.0
211 stars 53 forks source link

Unable to set indent for bullets #120

Closed darkalto2009 closed 2 months ago

darkalto2009 commented 2 months ago

Describe the bug @draco1023 I want to use HTMLRenderPolicy.java to set paragraphs. The paragraph can have 'ul' and 'ol' tags. I am trying to set the indent of the created bullets, but it getting set as 0. The issue is with the NumberingContext.java where the below code is written:

                    CTInd ind = cTLvl.addNewPPr().addNewInd();
                    ind.setLeft(BigInteger.valueOf(indent * i));

Here, when i = 0, then indent is set to 0, even when I try to set a value. Can we change this to below?

                    CTInd ind = cTLvl.addNewPPr().addNewInd();
                    ind.setLeft(BigInteger.valueOf(indent * (i+1)));
                    ind.setHanging(BigInteger.valueOf(hanging * (i+1)));

Also, can we add another configuration for ind.setHanging(...)? We can add a variable in HtmlRenderConfig.java just like custom numbering indent.

HTML content:

Expected behavior When I am setting the custom numbering indent in HtmlRenderConfig.java, I expect the indent to be applied properly. Also, indent hanging property should be available to format the bullet.

poi-tl-ext version: 0.4.15-poi5

poi-tl version: 1.12.2

darkalto2009 commented 2 months ago

Attaching patch for better understanding. FYR: Allow_changing_numbering_context_indent_and_hanging.patch

draco1023 commented 2 months ago

Indent is used to indicate the indentation between parent and child lists. For the first level offset, it's recommended to use margin or padding on the ul or ol tag. As for whether to add hanging, I will consider it.

darkalto2009 commented 2 months ago

@draco1023, please let me know, by when can I expect the changes to be released?

draco1023 commented 2 months ago

Try 0.4.18-poi5. Note: numberingHanging will have no effect when the value of list-style-position is inline.

darkalto2009 commented 2 months ago

@draco1023 Thank you for the quick turn around.