Compartilhar via


Propriedade WorksheetBase.PageSetup

Obtém Microsoft.Office.Interop.Excel.PageSetup que contém todas as configurações de configuração de página para a planilha.

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

Sintaxe

'Declaração
Public ReadOnly Property PageSetup As PageSetup
public PageSetup PageSetup { get; }

Valor de propriedade

Tipo: Microsoft.Office.Interop.Excel.PageSetup
Microsoft.Office.Interop.Excel.PageSetup que contém todas as configurações de configuração de página para a planilha.

Exemplos

O exemplo de código usa a propriedade de PageSetup para definir as margens inferior e do cabeçalho, o número de primeira página, e os cabeçalhos do centro e rodapés a planilha.

Este exemplo destina-se a uma personalização no nível de documento.

Private Sub AdjustPageFormat()
    With Me.PageSetup
        .BottomMargin = 10
        .FirstPageNumber = 1
        .HeaderMargin = 10
        .CenterHeader = "December Sales Forcasts"
        .CenterFooter = DateTime.Now.ToShortDateString()
    End With

    ' Enter a range value and then preview the worksheet to 
    ' display the page setup changes.
    Me.Range("A1", "A5").Value2 = "Sales"
    Me.PrintPreview(False)
End Sub
private void AdjustPageFormat()
{
    this.PageSetup.BottomMargin = 10;
    this.PageSetup.FirstPageNumber = 1;
    this.PageSetup.HeaderMargin = 10;
    this.PageSetup.CenterHeader = "December Sales Forcasts";
    this.PageSetup.CenterFooter = DateTime.Now.ToShortDateString();

    // Enter a range value and then preview the worksheet to 
    // display the page setup changes.
    this.Range["A1", "A5"].Value2 = "Sales";
    this.PrintPreview(false);
}

Segurança do .NET Framework

Consulte também

Referência

WorksheetBase Classe

Namespace Microsoft.Office.Tools.Excel