Proprietà WorksheetBase.PageSetup

Ottiene un oggetto Microsoft.Office.Interop.Excel.PageSetup che contiene tutte le impostazioni di pagina per il foglio di lavoro.

Spazio dei nomi:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel.v4.0.Utilities (in Microsoft.Office.Tools.Excel.v4.0.Utilities.dll)

Sintassi

'Dichiarazione
Public ReadOnly Property PageSetup As PageSetup
    Get
public PageSetup PageSetup { get; }

Valore proprietà

Tipo: Microsoft.Office.Interop.Excel.PageSetup
Oggetto Microsoft.Office.Interop.Excel.PageSetup che contiene tutte le impostazioni di pagina per il foglio di lavoro.

Esempi

Nell'esempio di codice riportato di seguito viene utilizzata la proprietà PageSetup per impostare i margini inferiore e di intestazione, il numero della prima pagina e le intestazioni e i piè di pagina centrali del foglio di lavoro.

Questo esempio è valido per una personalizzazione a livello di 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);
}

Sicurezza di .NET Framework

Vedere anche

Riferimenti

WorksheetBase Classe

Spazio dei nomi Microsoft.Office.Tools.Excel