显示或隐藏滚动条 Aspose.Cells

Aspose.Cells提供了一个类,工作簿表示一个 Excel 文件。这工作簿类提供了广泛的属性和方法来管理 Excel 文件。要控制滚动条的可见性,请使用工作簿设置班级'IsVScrollBarVisibleIsHScrollBar可见特性。IsVScrollBarVisibleIsHScrollBar可见是布尔属性,这意味着这些属性只能存储真的要么错误的值。

下面是打开 Excel 文件 book1.xls 的完整代码,隐藏两个滚动条,然后将修改后的文件保存为 output.xls 。

下面的屏幕截图显示了包含两个滚动条的 Book1.xls 文件。修改后的文件保存为output.xls文件,如下图所示。

Book1.xls:修改前的Excel文件

待办事项:图片_替代_文本

output.xls:修改后的Excel文件

待办事项:图片_替代_文本

C#

 //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

workbook.Save("output.xls");

//Closing the file stream to free all resources

fstream.Close();

下载运行代码

下载示例代码