Hi,
I am trying to set table height and font height in my table row cell. After setting font height and row height, it not fit with my slide. But after opening in MS Powerpoint when I am setting font, the all row height adjusted with the text height.
So, why I am not able to fit my row with their respective text height. I have also used minimalheight like
tbl.getRows().get_Item(row).setMinimalHeight(10);
but not succeeded.
please help in this regard
Hi Sanjay,
Thanks Adnan for your reply,
I am using following code to set the height of row
ITextFrame text = null;
for(int row = 0; row < tbl.getRows().size(); row++)
{
for (int cell = 0; cell < tbl.getRows().get_Item(row).size(); cell++)
{
text = tbl.getRows().get_Item(row).get_Item(cell).getTextFrame();
if (text != null)
{
if (text.getText().length() != 0)
{
text.getParagraphs().get_Item(0).getParagraphFormat().setAlignment(TextAlignment.Center);
text.getParagraphs().get_Item(0).getPortions().get_Item(0).getPortionFormat().setFontHeight(8);
tbl.getRows().get_Item(row).setMinimalHeight(10);
text.getParagraphs().get_Item(0).getPortions().get_Item(0).getPortionFormat().getFillFormat().setFillType(FillType.Solid);
text.getParagraphs().get_Item(0).getPortions().get_Item(0).getPortionFormat().getFillFormat().getSolidFillColor().setColor(Color.black);
}
}
}
}
Regards
Hi Sanjay,
//Create an instance of Presentation classPresentation pres = new Presentation(“D:\testrowheight.pptx”);//Get reference of the slideISlide slide = pres.getSlides().get_Item(0);IShape shape=null;for(int i=0;i<slide.getShapes().size();i++){shape= slide.getShapes().get_Item(i);if(shape instanceof ITable){ITable table=(ITable)shape;for(int j=0;j<table.getRows().size();j++){for(int k=0;k<table.getColumns().size();k++){ICell cell=table.get_Item(j, k);ITextFrame text=cell.getTextFrame();if(text!=null){if (text.getText().length() != 0){text.getParagraphs().get_Item(0).getParagraphFormat().setAlignment(TextAlignment.Center);text.getParagraphs().get_Item(0).getPortions().get_Item(0).getPortionFormat().setFontHeight(8);table.getRows().get_Item(j).setMinimalHeight(10);text.getParagraphs().get_Item(0).getPortions().get_Item(0).getPortionFormat().getFillFormat().setFillType(FillType.Solid);text.getParagraphs().get_Item(0).getPortions().get_Item(0).getPortionFormat().getFillFormat().getSolidFillColor().setColor(Color.GREEN);}}}}}pres.save(“D:\test.pptx”, SaveFormat.Pptx);