Free Support Forum -

Font Height and calling Table.Height throws Exception follow up

I did some more experimentation, and it seems that setting a Font
Height at all and then calling Table.Height is enough to cause an

An unhandled exception of type ‘System.ArgumentException’ occurred in system.drawing.dll

Additional information: ‘-0.72’
is not a valid value for ‘emSize’. ‘emSize’ should be greater than 0
and less than or equal to System.Single.MaxValue.

Sample Code:

Presentation pres = new Presentation(@“C:\empty.ppt”);

Slide slide = pres.Slides[0];

Table table = slide.Shapes.AddTable(1576, 1576, 4576, 3576, 2, 2);

Cell cell = table.GetCell(0,0);

cell.TextFrame.Paragraphs[0].Portions[0].Text = “Test text”;

cell.TextFrame.Paragraphs[0].Portions[0].FontHeight = 12;

// Code throws Exception Here

Console.Out.WriteLine("Table Height: " + table.Height);