# Workbook Views

Customize the workbook appearance based on specific preferences using DsExcel.

## Content

DsExcel allows users to personalize the display of the workbook. You can use the [BookView](/document-solutions/dot-net-excel-api/api/online/DS.Documents.Excel/GrapeCity.Documents.Excel.IWorkbook.BookView.html) property of the [IWorkbook](/document-solutions/dot-net-excel-api/api/online/DS.Documents.Excel/GrapeCity.Documents.Excel.IWorkbook.html) interface to set the view of the workbook as per your preferences. You can also customize display settings of the workbook by using the properties such as [DisplayHorizontalScrollBar](/document-solutions/dot-net-excel-api/api/online/DS.Documents.Excel/GrapeCity.Documents.Excel.IWorkbookView.DisplayHorizontalScrollBar.html), [DisplayHorizontalScrollBar](/document-solutions/dot-net-excel-api/api/online/DS.Documents.Excel/GrapeCity.Documents.Excel.IWorkbookView.DisplayHorizontalScrollBar.html), [DisplayWorkbookTabs](/document-solutions/dot-net-excel-api/api/online/DS.Documents.Excel/GrapeCity.Documents.Excel.IWorkbookView.DisplayWorkbookTabs.html) and [TabRatio](/document-solutions/dot-net-excel-api/api/online/DS.Documents.Excel/GrapeCity.Documents.Excel.IWorkbookView.TabRatio.html) of the [IWorkbookView](/document-solutions/dot-net-excel-api/api/online/DS.Documents.Excel/GrapeCity.Documents.Excel.IWorkbookView.html) interface.

```csharp
//Set workbook view

IWorkbook workbook = new Workbook();
var bookView = workbook.BookView;
bookView.DisplayHorizontalScrollBar = true;
bookView.DisplayVerticalScrollBar = true;
bookView.DisplayWorkbookTabs = true;
bookView.TabRatio = 0.8;
```

## Custom Views

DsExcel.NET also lets you save the views created by customizing properties or methods as custom views. Collection of custom views stored in a workbook is represented by **IWorkbook.CustomViews**. Each custom view in the collection is represented by **ICustomView** object and stores the view state of all worksheets in the current workbook. You can set **Name**, **RowColSettings** and **PrintSettings** properties for each custom view. To add a new custom view to a workbook, you can use the **Add** method. If a custom view name already exists in the collection, the new view overwrites the existing custom view. To apply a custom view to the workbook, you can use **ICustomView.Show** method. Similarly, you can delete custom views from the collection by calling **ICustomView.Delete** method.

> !type=note
> **Note:** The Add method does not allow addition of custom view and throws an exception in following cases:
>
> * When workbook contains a table or pivot table
> * When name of the custom view is null or whitespace

![](https://cdn.mescius.io/document-site-files/images/e333ad47-35da-43f9-a389-25433765f491/images/custom-view.png)

```csharp
IWorkbook workbook = new Workbook();
IWorksheet worksheet1 = workbook.ActiveSheet;
IWorksheet worksheet2 = workbook.Worksheets.Add();

worksheet1.Range["J12"].Value = 1;
worksheet2.Range["J12"].Value = 2;

// Add the normal view.
workbook.CustomViews.Add("Normal", true, true);

worksheet1.PageSetup.PrintArea = "$C$4:$J$12";
worksheet2.PageSetup.PaperSize = PaperSize.A4;

// Add a new view which saves the current page settings of all worksheets.
workbook.CustomViews.Add("PrintSetting", true, false);

worksheet1.Range["5:6"].Hidden = true;
worksheet2.Range["5:6"].Hidden = true;

// Add a new view which saves the current hidden rows/columns, filter settings of all worksheets.
workbook.CustomViews.Add("HiddenRows", false, true);

// Apply PrintSetting custom view 
workbook.CustomViews["PrintSetting"].Show();
        
// In the exported file, the user can switch between custom views.
workbook.Save("CustomViewAdd.xlsx");
```