Slides 2.8.5.0 has bullet points in table cell textframes after HasBullet=false

Alcrus,



I was setting the property before adding to the paragraph collection. Sorry for the incorrect notice.



Thanks.



Shaun

Hello,

I'm having the same problem in the Java-Versions 1.8.8 and 1.9. I'm creating a table and iterate over all cells. For each cell I delete the default paragraph and add multiple newly created paragraphs each with one new portion in it. When I save the PPT to disk, every paragraph in every cell has a bullet, although I called setHasBullet(false) on every paragraph. The code below shows a method which is called for every cell to set text and style. I think it explains itself:

/**
*

Set the cell properties.


*/
private void setCell(Cell cell, String text, int fillType, Color foreColor,
Color backColor, boolean isBold, boolean isItalic,
boolean isUnderline, Color fontColor, short height, int alignment) {

setCellStyle(cell, fillType, foreColor, backColor);

TextFrame frame = cell.getTextFrame();
frame.setMarginBottom(0.5f);
frame.setMarginLeft(0.8f);
frame.setMarginRight(0.8f);
frame.setMarginTop(0.5f);

ArrayList lines = new ArrayList();

// Check for line breaks
if (text.contains("\n")) {
if (text.contains("\r")) {
text = text.replaceAll("\r", "");
}
// Text contains line breaks
StringTokenizer tokenizer = new StringTokenizer(text, "\n");
while (tokenizer.hasMoreTokens()) {
String token = tokenizer.nextToken();
lines.add(token);
}
} else {
// No line breaks found
lines.add(text);
}

Iterator iter = lines.iterator();

frame.getParagraphs().remove(0);

while (iter.hasNext()) {
String line = iter.next();

Paragraph paragraph = new Paragraph();
paragraph.setHasBullet(false);
paragraph.setAlignment(alignment);

Portion portion = new Portion();
setPortionStyle(portion, isBold, isItalic, isUnderline,
fontColor, height);
portion.setText(line);
paragraph.getPortions().add(portion);

frame.getParagraphs().add(paragraph);
}
}

If I do the following it works:

...
Iterator iter = lines.iterator();

// TODO: Workaround for bullet bug
Paragraph paraTemplate = frame.getParagraphs().get(0);
paraTemplate.getPortions().remove(0);

frame.getParagraphs().remove(0);

while (iter.hasNext()) {
String line = iter.next();

Paragraph paragraph = new Paragraph(paraTemplate);
paragraph.setHasBullet(false);
paragraph.setAlignment(alignment);
...

If it helps, I use a template presentation and clone every slide from the first slide of the presentation. On one of this slides I create a new table. Do you have any ideas or a real fix (and not that workaround I built)?

Hello,

It looks like you didn’t read 2 or 3 previous posts carefully.

Paragraph and Portion objects should be added to the real TextFrame before changing any properties.
So you should change your code like this:

Paragraph paragraph = new Paragraph();
Portion portion = new Portion();
portion.setText(line);

paragraph.getPortions().add(portion);
frame.getParagraphs().add(paragraph);

paragraph.setHasBullet(false);
paragraph.setAlignment(alignment);
setPortionStyle(portion, isBold, isItalic, isUnderline,
fontColor, height);

Hello and thanks for the quick reply,

I just found it out myself a moment ago as I read the posts a second time (besides I missunderstood the previous post because I thought he added a setHasBullet(true)). My fault, sorry! But maybe you could add a hint to the doc or the FAQ or so that explains this, because I don't think this is obvious to everyone. Thanks!

Greets