protected bool DoesTextFit(string text, FontItem font) { SizeF layoutArea = new SizeF(684f, 900f); return((double)Graphics.FromImage((Image) new Bitmap(1, 1, PixelFormat.Format32bppArgb)).MeasureString(text, font.SetFont(), layoutArea).Height < 896.0); }
protected Microsoft.Office.Interop.PowerPoint.Shape AddDescriptorTextbox(Slide slide, string text, FontItem font) { var shape = slide.Shapes.AddTextbox(MsoTextOrientation.msoTextOrientationHorizontal, 12f, 492f, 300f, 36f); shape.TextFrame.AutoSize = PpAutoSize.ppAutoSizeNone; shape.TextFrame.TextRange.ParagraphFormat.Alignment = PpParagraphAlignment.ppAlignLeft; shape.TextFrame.VerticalAnchor = MsoVerticalAnchor.msoAnchorTop; shape.TextFrame.TextRange.Text = text; if (font != null) { font.SetOfficeFont(shape.TextFrame.TextRange); } return(shape); }