Spaces in table cells with bulleted paragraphs textframe

Hi,

attached a sample slide generated using aspose slides 1.8.0 fix latest version. I am generating the table with bulleted paragraphs with the margins set at 0. but I find a lot of gaps wthin the cells in the table.

I dont know why this is happening? please suggest.

the sample code is

Table table=slide.getShapes().addTable(xPosition,yPosition,tableWidth,tableHeight,
columns,rows,borderWidth,java.awt.Color.black);
table.setColumnWidth(0,2000);
table.setColumnWidth(1,2000);

while (resultset.next()){
if (count == table.getRowsNumber()){
count =0;
column=1;
}
TextFrame tf3=table.getCell(column,count).getTextFrame();
tf3.setMarginTop(0f);
tf3.setMarginLeft(0f);
tf3.setMarginRight(0f);
tf3.setMarginBottom(0f);
tf3.setWrapText(true);
Paragraph para = tf3.getParagraphs().get(0);
port=para.getPortions().get(0);
port.setFontColor(java.awt.Color.black);
//Setting the font height to 55
port.setFontHeight((short)10);
para.setHasBullet((short) 1);
//Setting the bullets color
para.setBulletColor(java.awt.Color.red);
//Setting the bullet height
para.setBulletHeight( (short) 125);
String value = rset1.getString(2);
port.setText(value);

}

Thanks,

prashanth

Dear prashanth,

You did not have attached any presentation.

However, I have run your code after doing few modifications to make it run able and attached the generated presentation. I don’t see lots of gaps.

Here is the code

//Instantiate a Presentation object that represents a PPT file
Presentation pres = new Presentation();

//Accessing a slide using its slide position
Slide slide = pres.getSlideByPosition(1);

Table table = slide.getShapes().addTable(
    100, 100, 1000, 1000, 2, 2, 3, java.awt.Color.black);
table.setColumnWidth(0, 2000);
table.setColumnWidth(1, 2000);

int count = 0;
int i = 2;
while (i > 0) {
    // if (count == table.getRowsNumber()){
        // count =0;
        // column=1;    
    // }

    i--;

    TextFrame tf3 = table.getCell(i, count++).getTextFrame();
    tf3.setMarginTop(0f);
    tf3.setMarginLeft(0f);
    tf3.setMarginRight(0f);
    tf3.setMarginBottom(0f);
    tf3.setWrapText(true);

    Paragraph para = tf3.getParagraphs().get(0);
    Portion port = para.getPortions().get(0);
    port.setFontColor(java.awt.Color.black);

    //Setting the font height to 55
    port.setFontHeight((short) 10);
    para.setHasBullet((short) 1);

    //Setting the bullets color
    para.setBulletColor(java.awt.Color.red);

    //Setting the bullet height
    para.setBulletHeight((short) 125);

    //String value = rset1.getString(2);
    port.setText("some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. some text. ");
}

//Writing the presentation as a PPT file
pres.write(new FileOutputStream(new File("c:\\modified.ppt")));

oops, In the attached presentation you can see the gaps in the cells. actually the gaps are more and i have slightly adjusted it in the presentation. can you tell me what is wrong?

Thanks,

prashanth

ok got it

prashanth

I have found that you have inserted each bulleted text in separate cells, that's why there are 18 rows for each column. This is the reason, there is so much spacing. If you want such an output, you don't need a table; you can add all these bulleted texts in a single textframe.