---
title: AutofitType
second_title: Aspose.Sildes pour .NET Référence API
description: Retourne ou définit le mode d'ajustement automatique des textes. Lecture/écriture TextAutofitTypeaspose.slides/textautofittype.
type: docs
weight: 30
url: /fr/aspose.slides/textframeformat/autofittype/
---

## Propriété TextFrameFormat.AutofitType

Retourne ou définit le mode d'ajustement automatique du texte. Lecture/écriture [`TextAutofitType`](../../textautofittype).

```csharp
public TextAutofitType AutofitType { get; set; }

Exemples

Le code d’exemple suivant montre comment redimensionner une forme pour adapter le texte dans une présentation PowerPoint.

[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);
}

Le code d’exemple suivant montre comment réduire le texte en cas de débordement.

[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);
}

Voir Aussi