PPTX Table Row Height

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,


Thank you for considering Aspose.Slides.

I have observed you comments and like to request you to please share with us the sample code and generated presentation with us so that we can investigate it on our end to help you out.

Best Regards,

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,


I have observed the code sample shared by you and have made necessary changes. Please try using following sample code on your end to serve the purpose.

//Create an instance of Presentation class
Presentation pres = new Presentation(“D:\testrowheight.pptx”);

//Get reference of the slide
ISlide 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);

I hope this will be helpful. Please share if I may help you further in this regard.

Best Regards,