Skip to content

KeepTogether on ListItem not implemented #380

Open

Description

@stonewoodman

The value keeptogether on a ListItem is ignored

ListItem listItem = new ListItem("multiline text...", font);
listItem.setKeepTogether(true);

expected result
The flag has the same behavior as by Paragraph.

Activity

  1. andreasrosdalw commented on Jun 18, 2020

    @andreasrosdalw
    Contributor

    Pull requests welcome.

  2. arnthom commented on Jun 18, 2020

    @arnthom

    OK, method getKeepTogether() is used in PdfDocument.add(Element) if the element is Paragraph, but not if it is ListItem, although ListItem extends Paragraph ...

    public boolean add(Element element) throws DocumentException {
    ...
            try {
                switch(element.type()) {
    ...
                    case Element.PARAGRAPH: {
    ...
                        // if a paragraph has to be kept together, we wrap it in a table object
                        if (paragraph.getKeepTogether()) {
    ...
                    case Element.LISTITEM: {
    ...
    
    
  3. linked a pull request that will close this issueImplement KeepTogether on ListItem #545on May 24, 2021
  4. linked a pull request that will close this issuefeat: keeptogether on a ListItem #547on May 24, 2021
  5. mraniketr commented on Feb 25, 2024

    @mraniketr

    does it need to be encapsulated in a table just like paragraph? as that is causing it to fail when using list item in a list component

  6. asturio commented on Mar 8, 2024

    @asturio
    Member

    Pull requests are still welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions