Version 2.2.1 - Multiple Portions with different Font Height causes Exception


I tested out the latest version 2.2.1 for table resizing and row
deletions and it works great for the most part. However, part of
my table building requires portions within a Table Cell to have
different Fonts, Font heights and bullets. Different combinations
of the font and bullet attributes still seem to throw an Exception when
Table.Height property is called. The exception that I
receive is:

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

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

Sample Code to produce this error:

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

Slide slide = pres.Slides[0];
Table table = slide.Shapes.AddTable(1*576, 1*576, 4*576, 3*576, 2, 2);

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

cell.TextFrame.Paragraphs[0].Portions[0].Text = "Text 1";
cell.TextFrame.Paragraphs[0].Portions[0].FontHeight = 9;

cell.TextFrame.Paragraphs[0].Portions.Add(new Portion("Text 2"));
cell.TextFrame.Paragraphs[0].Portions[1].FontHeight = 8;

// Code throws Exception Here
Console.Out.WriteLine("Table Height: " + table.Height);

With a PowerPoint presentation consisting of a single, empty slide (attached).

Keep up the great work!



Dear Chris,

Yes, this problem exists. It’s because some portions have font size equal to -1.

As a quick solution you can check all portions and set appropriate value for the font size.

We are working with it now and this problem will be fixed soon.



Thank you for the work around. I certainly appreciate how quickly you are able to resolve these issues.





Do you have a target date for a hotfix for this font height
problem? The workaround that you suggested didn’t seem to work in
my case.