Compartir a través de


WorksheetBase.SetBackgroundPicture (Método)

Establece el gráfico de fondo de la hoja de cálculo.

Espacio de nombres:  Microsoft.Office.Tools.Excel
Ensamblado:  Microsoft.Office.Tools.Excel.v4.0.Utilities (en Microsoft.Office.Tools.Excel.v4.0.Utilities.dll)

Sintaxis

'Declaración
Public Sub SetBackgroundPicture ( _
    filename As String _
)
public void SetBackgroundPicture(
    string filename
)

Parámetros

Ejemplos

El ejemplo de código siguiente utiliza el método SetBackgroundPicture para establecer la imagen de fondo de la hoja de cálculo en un archivo denominado image1.jpg.

Se trata de un ejemplo para una personalización en el nivel del documento.

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.");
    }
}

Seguridad de .NET Framework

Vea también

Referencia

WorksheetBase Clase

Microsoft.Office.Tools.Excel (Espacio de nombres)