AutofitType

TextFrameFormat.AutofitType-Eigenschaft

Gibt den Autofit-Modus des Textes zurück oder setzt ihn. Lese-/Schreibzugriff auf TextAutofitType.

public TextAutofitType AutofitType { get; set; }

Beispiele

Der folgende Beispielcode zeigt, wie man eine Form anpasst, um Text in einer PowerPoint-Präsentation anzupassen.

[C#]
 using (Presentation pres = new Presentation())
{
    ISlide slide = pres.Slides[0];
    IAutoShape autoShape = slide.Shapes.AddAutoShape(ShapeType.Rectangle, 30, 30, 350, 100);
    Portion portion = new Portion("lorem ipsum...");
    portion.PortionFormat.FillFormat.SolidFillColor.Color = Color.Black;
    portion.PortionFormat.FillFormat.FillType = FillType.Solid;
    autoShape.TextFrame.Paragraphs[0].Portions.Add(portion);
    ITextFrameFormat textFrameFormat = autoShape.TextFrame.TextFrameFormat;
    textFrameFormat.AutofitType = TextAutofitType.Shape;
    pres.Save("Output-presentation.pptx", SaveFormat.Pptx);
}

Der folgende Beispielcode zeigt, wie man Text bei Überlauf verkleinert.

[C#]
using (Presentation pres = new Presentation())
{
    ISlide slide = pres.Slides[0];
    IAutoShape autoShape = slide.Shapes.AddAutoShape(ShapeType.Rectangle, 30, 30, 350, 100);
    Portion portion = new Portion("lorem ipsum...");
    portion.PortionFormat.FillFormat.SolidFillColor.Color = Color.Black;
    portion.PortionFormat.FillFormat.FillType = FillType.Solid;
    autoShape.TextFrame.Paragraphs[0].Portions.Add(portion);
    ITextFrameFormat textFrameFormat = autoShape.TextFrame.TextFrameFormat;
    textFrameFormat.AutofitType = TextAutofitType.Normal;
    pres.Save("Output-presentation.pptx", SaveFormat.Pptx);
}

Siehe auch