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

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

Aspose.Cells提供了一个类,工作簿表示一个 Excel 文件。工作簿类提供了广泛的属性和方法来管理 Excel 文件。但是,为了控制 Excel 文件中滚动条的可见性,开发人员可以使用设置VScrollBar可见 & 设置 HScrollBar 可见的方法工作簿班级。

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");

下载运行代码

下载示例代码