Display or Hide Scroll Bars in Aspose.Cells

Aspose.Cells provides a class, Workbook that represents an Excel file. The Workbook class provides a wide range of properties and methods for managing an Excel file. To control the visibility of scroll bars, use the WorkbookSettings class' IsVScrollBarVisible and IsHScrollBarVisible properties. IsVScrollBarVisible and IsHScrollBarVisible are Boolean properties, which means that these properties can only store true or false values.

Below is a complete code that opens an Excel file, book1.xls, hides both scroll bars and then saves the modified file as output.xls .

The screenshot below shows Book1.xls file containing both scroll bars. The modified file is saved as output.xls file, also shown below.

Book1.xls: Excel file before any modification


output.xls: Excel file after modification



 //Creating a file stream containing the Excel file to be opened

FileStream fstream = new FileStream("book1.xls", FileMode.Open);

//Instantiating a Workbook object

//Opening the Excel file through the file stream

Workbook workbook = new Workbook(fstream);

//Hiding the vertical scroll bar of the Excel file

workbook.Settings.IsVScrollBarVisible = false;

//Hiding the horizontal scroll bar of the Excel file

workbook.Settings.IsHScrollBarVisible = false;

//Saving the modified Excel file


//Closing the file stream to free all resources


Download Running Code

Download Sample Code