Class OdsPageBackground

OdsPageBackground class

Represents the page background of ods.

public class OdsPageBackground

Constructors

NameDescription
OdsPageBackground()The default constructor.

Properties

NameDescription
Color { get; set; }Gets and sets the color of background.
GraphicData { get; set; }Gets and sets the graphic data.
GraphicPositionType { get; set; }Gets and set the background graphic position.
GraphicType { get; set; }Gets and sets the page background graphic type.
IsLink { get; }Indicates whether it’s a linked graphic.
LinkedGraphic { get; set; }Gets and sets the linked graphic path.
Type { get; set; }Gets and sets the page background type.

Examples

[C#]

using Aspose.Cells;
using Aspose.Cells.Ods;
using System;
using System.Drawing;

namespace Demos
{
    public class OdsPageBackgroundDemo
    {
        public static void OdsPageBackgroundExample()
        {
            // Create a new workbook
            Workbook workbook = new Workbook();
            Worksheet sheet = workbook.Worksheets[0];

            // Access the PageSetup object
            PageSetup pageSetup = sheet.PageSetup;

            // Access the ODSPageBackground object
            OdsPageBackground odsPageBackground = pageSetup.ODSPageBackground;

            // Set the background type to Color
            odsPageBackground.Type = OdsPageBackgroundType.Color;

            // Set the background color
            odsPageBackground.Color = Color.LightBlue;

            // Set the background graphic type
            odsPageBackground.GraphicType = OdsPageBackgroundGraphicType.Tile;

            // Set the background graphic position
            odsPageBackground.GraphicPositionType = OdsPageBackgroundGraphicPositionType.CenterCenter;

            // Set the linked graphic path (if any)
            odsPageBackground.LinkedGraphic = "path/to/graphic.png";

            // Save the workbook
            workbook.Save("OdsPageBackgroundExample.ods");
        }
    }
}

See Also