Setting Rowheight in tables


#1

Hi,
I have a table which will display 40+ rows of data. I have played with the font size and rowheight but can’t seem to get it to fit on the page. It seems like the rows are still much too high.
Please advise how I could shrink the height of this table. See attachment, slide2.
Thanks,
Jon


#2

Tables in PowerPoint have minimal height of each row.
You can read it through Table.GetMinimalRowHeight() function.
Aspose.Slides and MS PowerPoint can’t make rows smaller this value.

To correct it you can set very small Height of each row.
Let’s say 100. And rows will grow automatically from this value.


#3

Thanks Alexey,
I tried setting the rowheights to 10 and it still looks the same. Is there a workaround or another way to do what I’m trying to do? Should I try displaying the data without a table?

Jon


#4

Perhaps I’m doing something wrong, here’s the code:


Slide slide2 = pres.AddEmptySlide();

    Aspose.Slides.Table table_stats = slide2.Shapes.AddTable(500, 500, 3000, 150, 9, GridView1.Rows.Count,0, System.Drawing.Color.Beige);
    table_stats.AlternativeText = "tbl_Stats";
   

    for (i = 0; i .Cells[j].Text;
            table_stats.GetCell(j, i).TextFrame.Paragraphs[0].Portions[0].FontHeight = 6;
            int rh = table_stats.GetMinimalRowHeight(i);
            table_stats.SetRowHeight(i, 10);
        }
    }

#5

Please check last column in your table. The font size in these cells equal to 28.
If you set correct font size then height of rows will be recalculated automatically.


#6

Hi,
Can you tell me where you are seeing the 28 font size? If I open the attachment in powerpoint and click on the text, it shows 5 as the font size for every column.
Thanks,
Jon


#7

Jon, to decrease height of rows of the first table you should decrease font size in last empty column. To decrease height of rows of the second table, decrease text vertical margins (MarginTop and MarginBottom properties of each cell’s TextFrame).