View layouts not only lets you change the layout of sheets but also lets you decide how the worksheets should appear upon printing. Excel allows you to display sheets in different ways through ViewLayout property of the XLSheet class. The ViewLayout property accepts value from the ViewLayout enumeration to set the view layout to one of the following options:
Options | Snapshot | Descriptions |
---|---|---|
Normal | Displays the workbook in the default view. | |
PageBreakPreview | Divides the worksheet into separate pages. | |
PageLayout | Displays workbook using page layout. |
To change the view layout or the preview of the workbook, you can use the ViewLayout property as shown in the following code. Here, we set the value of ViewLayout property to PageLayout. This examples uses the sample created in the Quick Start topic.
C# |
Copy Code
|
---|---|
sheet.ViewLayout = ViewLayout.PageLayout; |