This project has moved. For the latest updates, please go here.

PowerPoint - Autosize table

Apr 4, 2013 at 8:29 AM
Edited Apr 4, 2013 at 12:52 PM
Hello,

I'm facing an issue with autosize and change font of my table.

I try to autosize my table in PowerPoint, but none of the following codes work.
pptshape.TextFrame2.AutoSize=NetOffice.OfficeApi.Enums.MsoAutoSize.msoAutoSizeTextToFitShape;
pptshape.TextFrame2.TextRange.Font.Size = 12;
pptshape.TextFrame2.AutoSize=NetOffice.PowerPointApi.Enums.PpAutoSize.ppAutoSizeNone;
The error I get is: NetOffice.PowerPointApi.TextFrame.set_AutoSize(PpAutoSize value)

while trying
pptshape.TextFrame2.TextRange.Font.Size = 12;
The other 2 codes don't work either.

I was trying to do something like in this forum, but with NetOffice.

MSDN

Is it possible to set the position of an object in PowerPoint in a certain place?

And the last question is, how can I split a table that has too many rows for 1 slide into different slides ?
Apr 4, 2013 at 1:52 PM
Found a way to change the font size, but still missing the AutoSize part and placing the shape in correct position.
foreach (PowerPoint.Slide slide in presentation.Slides)
{
        slide.Select();
        foreach (PowerPoint.Shape pptshape in slide.Shapes)
        {
               Console.WriteLine("Shape type : " + pptshape.Type.ToString());
               if (pptshape.Type.ToString().Equals("msoTable"))
               {
                     for (int i = 1; i <= pptshape.Table.Rows.Count; i++)
                     {
                           for (int j = 1; j <= pptshape.Table.Columns.Count; j++)
                           {
                                    pptshape.Table.Cell(i, j).Shape.TextFrame.TextRange.Font.Size = 12;
                            }
                      }
               }
         }
}
Apr 8, 2013 at 8:34 AM
Sebastian any idea maybe?

How to AutoSize content from front with table size?

Thanks.

mike