'DeclarationPublic Property FitToPageHeight As Short
'UsageDim instance As PageLayout Dim value As Short instance.FitToPageHeight = value value = instance.FitToPageHeight
public short FitToPageHeight {get; set;}
'DeclarationPublic Property FitToPageHeight As Short
'UsageDim instance As PageLayout Dim value As Short instance.FitToPageHeight = value value = instance.FitToPageHeight
public short FitToPageHeight {get; set;}
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.
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" ); } }
.NET: net5.0, net5.0-windows, net6.0, net6.0-macos, net6.0-windows, net7.0, net7.0-macos, net7.0-windows, net8.0, net8.0-browser, net8.0-macos, net8.0-windows, net9.0, net9.0-browser, net9.0-macos, net9.0-windows, net10.0, net10.0-browser, net10.0-macos, net10.0-windows.
.NET Framework: net40, net403, net45, net451, net452, net46, net461, net462, net463, net47, net471, net472, net48, net481.