Resizing the table with 2.1.4.0

Good morning

Thank you for delivering the functionality for sizing text holders and frames as promised.

My generated presentations are looking quite good now, my boss is happier, but I do still have one problem.

I think I am doing something wrong, if so please let me know.

In your 2.1.4.0 hotfix you mentioned about table cells resizing to the text. I have problems getting the size out of table
and cells.

Here is part of my code (somewhat simplified)

{
// Load up the table and get the cells
int rowCount = 4;
int columnCount = 4;

Slide slide = GetSlideNumber(myCurrentSlideNumber);
if (slide != null)
{
// now create the Aspose Powerpoint Table
Aspose.PowerPoint.Table outputTable =
slide.Shapes.AddTable(
100, 100, 100, 100,
columnCount, rowCount);

// Transfer data and properties from our format to Aspose.Powerpoint
for (int row = 0; row < rowCount; row++)
{
for (int col = 0; col < columnCount; col++)
{
// logic removed to keep it simple
Portion testPortion = new Portion("This needs to fit");

Aspose.PowerPoint.Cell aCell = outputTable.GetCell(col, row);
aCell.TextFrame.Paragraphs[0].Portions.Add(testPortion);
}
}
}
}.


The text is not legible because the cells are not sized properly. What I need is to work out how big this table
is so that I can resize it if necessary, but more importantly, I need to create other shapes directly below this.

Obviously the startpos of 100 is just for illustration, and the width and height of 100 is because I do not know how big
the table will be after inserting all the text.

I need to create additional pictures or tabled below this table, so I need this table to resize, and to work out how big it ended up being..

I've checked a multitude of width and height, but I cannot find any that make sense.


Thanks
cwad

Dear cwad,



Resizing of tables works like in MS PowerPoint.

  1. You should set correct width of columns by yourself.
  2. When you add text height of row will be automatically increased.
  3. If you delete some text then height of row will not be changed.

First, the resizing is a great feature!

I too am having a small resizing problem with Tables. The table resizes but it does not seem to be resizing properly. It can be reproduced by creating a one slide presentation where the slide contains a table like the following:

    Title
  • one
    Title
  • one
    Title
  • one

Then using the following code, we add additional bullet points (two, three) to each cell.

Presentation pres = new Presentation(file);
Slide slide = pres.GetSlideByPosition(2);
foreach (Shape shape in slide.Shapes)
{
if (shape is Table)
{
Table t = shape as Table;
foreach (Shape tshape in t.Shapes)
{
if (tshape.TextFrame != null)
{
tshape.TextFrame.FitShapeToText = true;
for(int i=0;i {
if (tshape.TextFrame.Paragraphs[ i].Text == "one")
tshape.TextFrame.Paragraphs[ i].Portions[0].Text = "one\rtwo\rthree\r";
}
}
}
}
}

After saving the presetaion, I re-open it using Microsoft PowerPoint. The table has resized a little but text spills over. I have tried to attach a screen shot of the resulting table (i have yet to get an attachment to post).

If I am doing something wrong, please let me know as I need this functionality for the application I am writing. If this is a bug, will it be possible to get it fixed?

-johnStick out tongue [:P]

(I'm using Aspose.PowerPoint version 2.2.4.0)