Back to Devexpress

Table.Fill Property

officefileapi-devexpress-dot-docs-dot-presentation-dot-table-9657b88e.md

latest3.9 KB
Original Source

Table.Fill Property

Gets or sets the fill applied to the table background.

Namespace : DevExpress.Docs.Presentation

Assembly : DevExpress.Docs.Presentation.v25.2.dll

NuGet Package : DevExpress.Docs.Presentation

Declaration

csharp
public Fill Fill { get; set; }
vb
Public Property Fill As Fill

Property Value

TypeDescription
Fill

A fill applied to the table background.

|

Remarks

You can apply the following fill types to a table:

The following code snippet specifies the table fill:

csharp
using DevExpress.Docs;
using DevExpress.Docs.Presentation;
using System.Drawing;

namespace PresentationApiSample;

public class Program {
    public static void Main(string[] _) {
        // Create an in-memory Presentation document
        Presentation presentation = new Presentation(File.ReadAllBytes(@"..\..\..\data\Presentation2.pptx"));

        // Add a blank slide to the presentation
        Slide slide = new Slide(SlideLayoutType.Blank);
        presentation.Slides.Add(slide);

        // Create a 3x3 table (rows x columns) and add it as a shape to the slide
        Table table = new Table(3, 3);
        table.X = 100;
        table.Y = 100;
        slide.Shapes.Add(table);

        for (int row = 0; row < 3; row++) {
            for (int column = 0; column < 3; column++) {
                table[row, column].TextArea.Text = $"({row}, {column})";
            }
        }
        // Apply a style and fill to the table
        table.Style = new ThemedTableStyle(TableStyleType.NoStyleTableGrid);
        table.Fill = new SolidFill(new OfficeColor(Color.Yellow));

    }
}
vb
Imports DevExpress.Docs
Imports DevExpress.Docs.Presentation
Imports System.Drawing

Namespace PresentationApiSample
    Public Class Program
        Public Shared Sub Main(args As String())
            ' Create an in-memory Presentation document
            Dim presentation As New Presentation(File.ReadAllBytes("..\..\..\data\Presentation2.pptx"))

            ' Add a blank slide to the presentation
            Dim slide As New Slide(SlideLayoutType.Blank)
            presentation.Slides.Add(slide)

            ' Create a 3x3 table (rows x columns) and add it as a shape to the slide
            Dim table As New Table(3, 3)
            table.X = 100
            table.Y = 100
            slide.Shapes.Add(table)

            For row As Integer = 0 To 2
                For column As Integer = 0 To 2
                    table(row, column).TextArea.Text = $"({row}, {column})"
                Next
            Next
            ' Apply a style and fill to the table
            table.Style = New ThemedTableStyle(TableStyleType.NoStyleTableGrid)
            table.Fill = New SolidFill(New OfficeColor(Color.Yellow))

        End Sub
    End Class
End Namespace

See Also

DevExpress Presentation API Library: Set Slide Background

Table Class

Table Members

DevExpress.Docs.Presentation Namespace