SpreadsheetBackgroundWatermarkOptions

SpreadsheetBackgroundWatermarkOptions class

Represents options when adding the watermark as a background to a Spreadsheet worksheet.

public sealed class SpreadsheetBackgroundWatermarkOptions : WatermarkOptions

Constructors

Name Description
SpreadsheetBackgroundWatermarkOptions() Initializes a new instance of the SpreadsheetBackgroundWatermarkOptions class.

Properties

Name Description
BackgroundHeight { get; set; } Gets or sets the desired height of the background image in pixels.
BackgroundWidth { get; set; } Get or sets the desired width of the background image in pixels.
WorksheetIndex { get; set; } Get or sets the index of worksheet to add the watermark to.

Remarks

Learn more:

Examples

Add text watermark to an Excel document worksheet as background.

SpreadsheetLoadOptions loadOptions = new SpreadsheetLoadOptions();
using (Watermarker watermarker = new Watermarker(@"C:\Documents\test.xlsx", loadOptions))
{
    TextWatermark watermark = new TextWatermark("Test watermark", new Font("Arial", 36));

    SpreadsheetBackgroundWatermarkOptions options = new SpreadsheetBackgroundWatermarkOptions();
    options.WorksheetIndex = -1; // default
    options.BackgroundWidth = 800;
    options.BackgroundHeight = 600;

    watermarker.Add(watermark, options);
    watermarker.Save();
}

See Also