Export (0) Print
Expand All
Expand Minimize

WorksheetBase.SetBackgroundPicture Method

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Sets the background graphic for the worksheet.

Namespace:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel.v4.0.Utilities (in Microsoft.Office.Tools.Excel.v4.0.Utilities.dll)

public void SetBackgroundPicture(
	string filename
)

Parameters

filename
Type: System.String

The name of the graphic file.

The following code example uses the SetBackgroundPicture method to set the background image of the worksheet to a file named image1.jpg.

This example is for a document-level customization.

private void SetWorksheetPicture()
{
    string backgroundFilePath = @"C:\image1.jpg";

    if (System.IO.File.Exists(backgroundFilePath))
    {
        this.SetBackgroundPicture(@"C:\image1.jpg");
    }
    else
    {
        MessageBox.Show(@"The file C:\image1.jpg does not exist.");
    }
}

Show:
© 2014 Microsoft