File Formats

Upgrade Guide User Guide Demos Support Forums Download
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Interface IFill - FileFormats API Reference | Syncfusion

    Show / Hide Table of Contents

    Interface IFill

    Represents the fill format options of the object.

    Namespace: Syncfusion.Presentation
    Assembly: Syncfusion.Presentation.Base.dll
    Syntax
    public interface IFill
    Remarks

    A fill format can have a solid, gradient, pattern, texture type.

    Properties

    FillType

    Gets or sets the FillType of the object.

    Declaration
    FillType FillType { get; set; }
    Property Value
    Type Description
    FillType
    Examples
    //Open a presentation.
    IPresentation presentation = Presentation.Open("Template.pptx");
    //Add a slide to the presentation.
    ISlide slide = presentation.Slides.Add();
    //Get the fill of slide background
    IFill fill = slide.Background.Fill;
    //Set the fill type
    fill.FillType = FillType.Solid;
    //Set the fill color
    fill.SolidFill.Color = ColorObject.Red;
    //Save the presentation
    presentation.Save("Sample.pptx");
    //Close the presentation
    presentation.Close();
    'Open a presentation
    Dim presentation__1 As IPresentation = Presentation.Open("Template.pptx")
    'Add a slide to the presentation.
    Dim slide As ISlide = presentation__1.Slides.Add()
    'Get the fill of slide background
    Dim fill As IFill = slide.Background.Fill
    'Set the fill type
    fill.FillType = FillType.Solid
    'Set the fill color
    fill.SolidFill.Color = ColorObject.Red
    'Save the presentation
    presentation__1.Save("Sample.pptx")
    'Close the presentation
    presentation__1.Close()

    GradientFill

    Gets an IGradientFill instance. Read-only.

    Declaration
    IGradientFill GradientFill { get; }
    Property Value
    Type Description
    IGradientFill

    The gradient fill.

    Examples
    //Create a new presentation.
    IPresentation presentation = Presentation.Create();
    //Add a slide to the presentation.
    ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
    //Add shape to slide
    IShape shape = slide.Shapes.AddShape(AutoShapeType.BlockArc, 12, 23, 100, 220);
    //Retrieve fill from shape
    IFill fill = shape.Fill;
    //Set gradient fill to the shape
    fill.FillType = FillType.Gradient;
    //Retrieve the gradient fill from the shape
    IGradientFill gradientFill = fill.GradientFill;           
    //Add the first gradient stop.
    gradientFill.GradientStops.Add();
    //Add the second gradient stop.
    gradientFill.GradientStops.Add();
    //Save the presentation
    presentation.Save("GradientFill.pptx");
    //Close the presentation
    presentation.Close();
    'Create a new presentation
    Dim presentation__1 As IPresentation = Presentation.Create()
    'Add a slide to the presentation.
    Dim slide As ISlide = presentation__1.Slides.Add(SlideLayoutType.Blank)
    'Add shape to slide
    Dim shape As IShape = slide.Shapes.AddShape(AutoShapeType.BlockArc, 12, 23, 100, 220)
    'Retrieve fill from shape
    Dim fill As IFill = shape.Fill
    'Set gradient fill to the shape
    fill.FillType = FillType.Gradient
    'Retrieve the gradient fill from the shape
    Dim gradientFill As IGradientFill = fill.GradientFill
    'Add the first gradient stop.
    gradientFill.GradientStops.Add()
    'Add the second gradient stop.
    gradientFill.GradientStops.Add()
    'Save the presentation
    presentation__1.Save("GradientFill.pptx")
    'Close the presentation
    presentation__1.Close()

    PatternFill

    Gets an IPatternFill instance. Read-only.

    Declaration
    IPatternFill PatternFill { get; }
    Property Value
    Type Description
    IPatternFill

    The pattern fill.

    Examples
    //Create a new presentation.
    IPresentation presentation = Presentation.Create();
    //Add a slide to the presentation.
    ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
    //Add shape to slide
    IShape shape = slide.Shapes.AddShape(AutoShapeType.BlockArc, 12, 23, 100, 220);
    //Retrieve fill from shape
    IFill fill = shape.Fill;
    //Set pattern fill type to shape
    fill.FillType = FillType.Pattern;
    //Create instance to hold pattern fill properties
    IPatternFill patternFill = fill.PatternFill;
    //Set the pattern type
    patternFill.Pattern = PatternFillType.DashedDownwardDiagonal;
    //Set back color for the pattern
    patternFill.BackColor = ColorObject.PaleGreen;
    //Set fore color for the pattern
    patternFill.ForeColor = ColorObject.Blue;
    //Save the presentation
    presentation.Save("PatternFill.pptx");
    //Close the presentation
    presentation.Close();
    'Create a new presentation.
    Dim presentation__1 As IPresentation = Presentation.Create()
    'Add a slide to the presentation.
    Dim slide As ISlide = presentation__1.Slides.Add(SlideLayoutType.Blank)
    'Add shape to slide
    Dim shape As IShape = slide.Shapes.AddShape(AutoShapeType.BlockArc, 12, 23, 100, 220)
    'Retrieve fill from shape
    Dim fill As IFill = shape.Fill
    'Set pattern fill type to shape
    fill.FillType = FillType.Pattern
    'Create instance to hold pattern fill properties
    Dim patternFill As IPatternFill = fill.PatternFill
    'Set the pattern type
    patternFill.Pattern = PatternFillType.DashedDownwardDiagonal
    'Set back color for the pattern
    patternFill.BackColor = ColorObject.PaleGreen
    'Set fore color for the pattern
    patternFill.ForeColor = ColorObject.Blue
    'Save the presentation
    presentation__1.Save("PatternFill.pptx")
    'Close the presentation
    presentation__1.Close()

    PictureFill

    Gets an IPictureFill instance. Read-only.

    Declaration
    IPictureFill PictureFill { get; }
    Property Value
    Type Description
    IPictureFill

    The picture fill.

    SolidFill

    Gets an ISolidFill instance. Read-only.

    Declaration
    ISolidFill SolidFill { get; }
    Property Value
    Type Description
    ISolidFill

    The solid fill.

    Examples
    //Open a presentation.
    IPresentation presentation = Presentation.Open("Template.pptx");
    //Add a slide to the presentation.
    ISlide slide = presentation.Slides.Add();
    //Get the fill of slide background
    IFill fill = slide.Background.Fill;
    //Set the fill type
    fill.FillType = FillType.Solid;
    //Set the fill color
    fill.SolidFill.Color = ColorObject.Red;
    //Save the presentation
    presentation.Save("Sample.pptx");
    //Close the presentation
    presentation.Close();
    'Open a presentation.
    Dim presentation__1 As IPresentation = Presentation.Open("Template.pptx")
    'Add a slide to the presentation.
    Dim slide As ISlide = presentation__1.Slides.Add()
    'Get the fill of slide background
    Dim fill As IFill = slide.Background.Fill
    'Set the fill type
    fill.FillType = FillType.Solid
    'Set the fill color
    fill.SolidFill.Color = ColorObject.Red
    'Save the presentation
    presentation__1.Save("Sample.pptx")
    'Close the presentation
    presentation__1.Close()
    Back to top Generated by DocFX
    Copyright © 2001 - 2022 Syncfusion Inc. All Rights Reserved