We have a requirement in our project where bullet list is not aligning correctly as MS PPT does.
Problem is when the text exceeds one line in a list, the new line will start right below the bullet and not at the beginning of the text. We need the new line to be aligned right below the first line text as shown in the attached screenshot.
Request to please help with a solution for this.
Screenshot 2023-06-14 at 3.26.45 PM.png (40.9 KB)
@Ganesh1402,
Thank you for contacting support.
To achieve your requirements, you can use the IParagraphFormat interface like this:
paragraph.getParagraphFormat().setMarginLeft(20);
Thank you for the support.
With the above implementation too, I am still facing the same issue.
Sharing the code snippet implemented as below:
Paragraph paragraph = new Paragraph();
paragraph.getParagraphFormat().getBullet().setType(BulletType.Symbol);
paragraph.getParagraphFormat().getBullet().setChar(Character.toChars(8227)[0]);
paragraph.getParagraphFormat().getBullet().setBulletHardColor(NullableBool.True);
paragraph.getParagraphFormat().setDepth((short) 0);
paragraph.getParagraphFormat().setAlignment(TextAlignment.Justify);
paragraph.getParagraphFormat().setIndent(15);
paragraph.getParagraphFormat().setSpaceAfter(20);
paragraph.getParagraphFormat().setMarginLeft(20);
IPortionFormat portionFormat = paragraph.getParagraphFormat().getDefaultPortionFormat();
portionFormat.setLatinFont(new FontData(fontName));
portionFormat.setFontHeight(fontHeight);
portionFormat.getFillFormat().setFillType(FillType.Solid);
portionFormat.getFillFormat().getSolidFillColor().setColor(Color.black);
portionFormat.setFontBold(NullableBool.False);
paragraph.setText(text);
return paragraph;
Here String text = “Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus”
Also attaching the Multiline Bullet Paragraph generated on the ppt.
Screenshot 2023-06-15 at 2.03.28 PM.png (26.4 KB)
Request to please help with the issue.
@Ganesh1402,
Thank you for the code snippet. The hanging indent for the paragraph can be defined with negative values using the setIndent mehod and the setMarginLeft
method like this:
// paragraph.getParagraphFormat().setIndent(15);
paragraph.getParagraphFormat().setIndent(-15);
paragraph.getParagraphFormat().setMarginLeft(15);
1 Like
Thank you for the solution. It works as per the requirement.
@Ganesh1402,
Thank you for using Aspose.Slides.