Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
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)
Syntax
'Declaration
Public Sub SetBackgroundPicture ( _
filename As String _
)
public void SetBackgroundPicture(
string filename
)
Parameters
filename
Type: System.StringThe name of the graphic file.
Examples
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 Sub SetWorksheetPicture()
Dim backgroundFilePath As String = "C:\image1.jpg"
If System.IO.File.Exists(backgroundFilePath) Then
Me.SetBackgroundPicture("C:\image1.jpg")
Else
MsgBox("The file C:\image1.jpg does not exist.")
End If
End Sub
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.");
}
}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.