在xlsx4j中显示和隐藏工作簿的滚动条

Aspose.Cells - 显示和隐藏工作簿的滚动条

Aspose.Cells提供了一个代表Excel文件的Workbook类。Workbook类提供了广泛的属性和方法来管理Excel文件。但是,为了控制Excel文件中滚动条的可见性,开发人员可以使用Workbook类的setVScrollBarVisiblesetHScrollBarVisible方法。

Java

 //Instantiating a Excel object by excel file path

Workbook workbook = new Workbook(dataDir + "book1.xls");

//Hiding the vertical scroll bar of the Excel file

workbook.getSettings().setVScrollBarVisible(false);

//Hiding the horizontal scroll bar of the Excel file

workbook.getSettings().setHScrollBarVisible(false);

//Saving the modified Excel file in default (that is Excel 2003) format

workbook.save(dataDir + "AsposeSrollbarsHide.xls");

// ===============================================================

//Displaying the vertical scroll bar of the Excel file

workbook.getSettings().setVScrollBarVisible(true);

//Displaying the horizontal scroll bar of the Excel file

workbook.getSettings().setHScrollBarVisible(true);

//Saving the modified Excel file in default (that is Excel 2003) format

workbook.save(dataDir + "AsposeDisplaySrollbars.xls");

下载运行代码

下载示例代码