如何控制选项卡工具栏

可能的使用场景

当您需要调整Excel表单栏的显示时,您需要了解如何控制选项卡工具栏,例如隐藏或显示选项卡工具栏,更改选项卡工具栏宽度,指定第一个可见选项卡等。Aspose.Cells支持这些功能。 Aspose.Cells提供以下属性和方法来帮助您实现您的目标。

使用Aspose.Cells for .NET学习如何控制工作表选项卡栏。

此示例演示如何:

  1. 创建一个工作簿。
  2. 在第一个工作表中的单元格中添加数据。
  3. 显示工作表标签并设置标签栏的宽度。
//Instantiating an Workbook object
Workbook workbook = new Workbook();
//Obtaining the reference of the newly added worksheet
Worksheet ws = workbook.Worksheets[0];
Aspose.Cells.Cells cells = ws.Cells;
//Setting the value to the cells
Aspose.Cells.Cell cell = cells["A1"];
cell.PutValue("Fruit");
cell = cells["B1"];
cell.PutValue("Count");
cell = cells["C1"];
cell.PutValue("Price");
cell = cells["A2"];
cell.PutValue("Apple");
cell = cells["A3"];
cell.PutValue("Mango");
cell = cells["A4"];
cell.PutValue("Blackberry");
cell = cells["A5"];
cell.PutValue("Cherry");
//Display the sheet tab and set the width of the tab bar
workbook.Settings.ShowTabs = true;
workbook.Settings.SheetTabBarWidth = 150;
workbook.Save("out.xlsx");

结果文件预览: