Xceed Workbooks for .NET v3.0 Documentation
Xceed.Workbooks.NET Assembly / Xceed.Workbooks.NET Namespace / PageLayout Class / FitToPageHeight Property
Example


In This Topic
    FitToPageHeight Property
    In This Topic
    Gets or sets how the content's height will be scaled when the Worksheet is printed.
    Syntax
    'Declaration
     
    
    Public Property FitToPageHeight As Short
    'Usage
     
    
    Dim instance As PageLayout
    Dim value As Short
     
    instance.FitToPageHeight = value
     
    value = instance.FitToPageHeight
    public short FitToPageHeight {get; set;}
    Remarks

    The value of this property corresponds to a number of pages.

    The default value is 0, which means that the content will not be scaled in any way, height-wise.

    If the value was set to 2, for example, the content's height would be scaled to fit 2 pages. The content's width, however, would not be affected; scaling the width would have to be done via the FitToPageWidth property.  

    Example
    public static void PageOrientationAndSetup()
    {
      using( var workbook = Workbook.Create(PageLayoutSample.PageLayoutSampleOutputDirectory + @"PageSetup.xlsx"))
        {
          //Gets the first worksheet; a workbook contains at least 1 worksheet.
          var worksheet = workbook.Worksheets[0];
    	  
          // Adds a title.
          worksheet.Cells["B1"].Value = "Page Setup";
          worksheet.Cells["B1"].Style.Font = new Font() {Bold = true, Size = 15.5d};
    	  
          // Sets the Landscape orientation.
          worksheet.PageLayout.Orientation = OrientationType.Landscape;
    	  
          // Adjusts the paper size.
          worksheet.PageLayout.PageSize = PaperSizeType.Executive;
    
          // Adjusts fit to width & fit to height settings. Note that if the value is not 0, the Scale property is overridden.
          worksheet.PageLayout.FitToPageWidth = 2;
          worksheet.PageLayout.FitToPageHeight = 3;
    	  
          // Saves the workbook to disk.
          workbook.Save();
          Console.WriteLine( "/tCreated: PageSetup.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