We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Cannot set table's text box internal margin

Hi,


I am using Aspose Slides 15.11.0 in JAVA. I am trying to export a table. The problem is that I cannot set the text box internal margins. Below is part of my code.


ITable iTable = iSlide.getShapes().addTable(templateMetadata.getxPoint(), templateMetadata.getyPoint(),
dblCols, dblRows);

iTable.setFirstRow(table.getHasHeader());
iTable.setStylePreset(TableStylePreset.LightStyle2Accent1);

int fontSize = calculateFontSize(rowWidth, table.getDataFontSize().getExportSize());

for (int row = 0; row < iTable.getRows().size(); row++) {
for (int cell = 0; cell < iTable.getRows().get_Item(row).size(); cell++) {
iTable.getRows().get_Item(row).get_Item(cell).getBorderTop().getFillFormat().setFillType(FillType.Solid);
iTable.getRows().get_Item(row).get_Item(cell).getBorderLeft().getFillFormat().setFillType(FillType.Solid);
iTable.getRows().get_Item(row).get_Item(cell).getBorderRight().getFillFormat().setFillType(FillType.Solid);
iTable.getRows().get_Item(row).get_Item(cell).getBorderBottom().getFillFormat().setFillType(FillType.Solid);
iTable.getRows().get_Item(row).get_Item(cell).getBorderTop().getFillFormat().getSolidFillColor().setColor(Color.LIGHT_GRAY);
iTable.getRows().get_Item(row).get_Item(cell).getBorderLeft().getFillFormat().getSolidFillColor().setColor(Color.LIGHT_GRAY);
iTable.getRows().get_Item(row).get_Item(cell).getBorderRight().getFillFormat().getSolidFillColor().setColor(Color.LIGHT_GRAY);
iTable.getRows().get_Item(row).get_Item(cell).getBorderBottom().getFillFormat().getSolidFillColor().setColor(Color.LIGHT_GRAY);
iTable.getRows().get_Item(row).get_Item(cell).getBorderTop().setWidth(1);
iTable.getRows().get_Item(row).get_Item(cell).getBorderLeft().setWidth(1);
iTable.getRows().get_Item(row).get_Item(cell).getBorderRight().setWidth(1);
iTable.getRows().get_Item(row).get_Item(cell).getBorderBottom().setWidth(1);

iTable.getRows().get_Item(row).get_Item(cell).getTextFrame().getTextFrameFormat().setMarginBottom(0d);
iTable.getRows().get_Item(row).get_Item(cell).getTextFrame().getTextFrameFormat().setMarginTop(0d);
iTable.getRows().get_Item(row).get_Item(cell).getTextFrame().getTextFrameFormat().setMarginLeft(0d);
iTable.getRows().get_Item(row).get_Item(cell).getTextFrame().getTextFrameFormat().setMarginRight(0d);

iTable.getRows().get_Item(row).get_Item(cell).setAnchorCenter(true);
iTable.getRows().get_Item(row).get_Item(cell).setTextAnchorType(TextAnchorType.Center);

iTable.getRows().get_Item(row).get_Item(cell).getTextFrame().getParagraphs().get_Item(0).getPortions().get_Item(0)
.getPortionFormat().setFontHeight(fontSize + (row == 0 ? 1 : 0));

iTable.getRows().get_Item(row).get_Item(cell).getTextFrame().getParagraphs().get_Item(0).getPortions().get_Item(0).getPortionFormat
().setFontBold(row == 0 ? table.getHasHeader() ? NullableBool.True : NullableBool.False : NullableBool.False);

}
}

Best regards,
Alex

Hi Alex,


Thank you for your interest in Aspose.Slides.

I have observed your requirements but I am unable to understand them completely. Please share with us a sample presentation created using PowerPoint, as expected output, and the steps to set internal margins while using PowerPoint so that we may proceed further to help you out.

Best Regards,