Setting row height in TableEx in PPTX

Hi,

I am able to set column width. How to set row height in TableEx as the property is read-only?

What is the use of Minimal Height?

Hi Htanmo,


Please use the code snippet shared below to set the row height. I have used Aspose.Slides for .NET 5.8.0 for my verification.

PresentationEx pres = new PresentationEx(“D:\Aspose Data\Sample.pptx”);

//Accessing a slide using its slide position
SlideEx slide = pres.Slides[0];

//Setting table object to null
TableEx table = null;

//Iterating through all shapes unless the desired table is found
for (int i = 0; i < slide.Shapes.Count; i++)
{

if (slide.Shapes[i] is TableEx)
{

table = (TableEx)slide.Shapes[i];

foreach (RowEx row in table.Rows)
{
//Setting row heighht
row.MinimalHeight += 20;
foreach (CellEx cells in row)
{
//Setting the data in text frame
TextFrameEx tf = cells.TextFrame;

tf.Paragraphs[0].Portions[0].Text = “This is”;//test data This is test data This is test data This is test data This is test data This is test data This is test data This is test data ";
}

}

}

}

pres.Write(“D:\Aspose Data\modified.pptx”);

Many Thanks,

Is row height kept increasing as u have used increment of 20 @ row.MinimalHeight+=20?

But in the attachment all rows are with same height.

Say, I have used

table.SetRowHeight(i, 12) in PPT

What shall be used in PPTX?

Hi Htanmo,


The code snippet that I have shared with you is actually adding factor of 20 in each row of the table and this gets accumulated in actual table height as well. Setting the table width or height on table level will not work and one may need to set that on row or column level. This is in fact not an issue with Aspose.Slides.

Many Thanks,

Thanks Mudassir.

But I can create a new table by passing width and height as parameters.

I used

int tableIndex = slide.Shapes.AddTable(xPosition / 8, yPosition / 8, columnWidths, rowWidths);

TableEx table = (TableEx)slide.Shapes[tableIndex];

Is the usage correct?

So initially I am creating table with some row height and col width. Then I would like to change.

Hi Htanmo,


I like to share that once you have created the table you cannot modify the table size directly, but you can alter the row size of generated table that will actually account to table size. Hope it clears the concept.

Many Thanks,