Xceed Workbooks for .NET v3.0 Documentation
Xceed.Workbooks.NET Assembly / Xceed.Workbooks.NET Namespace / Margins Class / SetAll Method
The Left Margin's value.
The Right Margin's value.
The Top Margin's value.
The Bottom Margin's value.
The Header's value.
The Footer's value. 
Example


In This Topic
    SetAll Method
    In This Topic
    Sets all of the Worksheet's Margins at the same time.
    Syntax
    'Declaration
     
    
    Public Sub SetAll( _
       ByVal left As Single, _
       ByVal right As Single, _
       ByVal top As Single, _
       ByVal bottom As Single, _
       ByVal header As Single, _
       ByVal footer As Single _
    ) 
    'Usage
     
    
    Dim instance As Margins
    Dim left As Single
    Dim right As Single
    Dim top As Single
    Dim bottom As Single
    Dim header As Single
    Dim footer As Single
     
    instance.SetAll(left, right, top, bottom, header, footer)
    public void SetAll( 
       float left,
       float right,
       float top,
       float bottom,
       float header,
       float footer
    )

    Parameters

    left
    The Left Margin's value.
    right
    The Right Margin's value.
    top
    The Top Margin's value.
    bottom
    The Bottom Margin's value.
    header
    The Header's value.
    footer
    The Footer's value. 
    Example
    public static void PageMarginsAndPageBreaks()
    {
      using( var workbook = Workbook.Create( PageLayoutSample.PageLayoutSampleOutputDirectory + @"PageMarginsAndBreaks.xlsx" ))
        {
          // Gets the first worksheet; a workbook always contains at least 1 worksheet.
          var worksheet = workbook.Worksheets[0];
    	  
          // Adds a title.
          worksheet.Cells["B1"].Value = "Page Margins and Breaks";
          worksheet.Cells["B1"].Style.Font = new Font() {Bold = true, Size = 15.5d};
    	  
          // Sets all margins using custom values
          worksheet.PageLayout.Margins.SetAll( 0.7f, 0.7f, 0.5f, 0.5f, 0.4f, 0.4f );
    
          // Saves workbook to disk.
          workbook.Save();
          Console.WriteLine( "/tCreated:PageMarginsAndBreaks.xlsx/n" );
        }
    }
    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

    See Also