设置工作表标签颜色

使用Microsoft Excel设置工作表标签颜色

  1. 在当前工作表底部的标签工作表上右键单击。
  2. 选择标签颜色
  3. 从调色板中选择一种颜色。
  4. 点击确定

选项卡已着上红色、绿色和蓝色

todo:image_alt_text

使用Aspose.Cells设置工作表选项卡颜色

以下示例代码显示如何使用Aspose.Cells来设置选项卡颜色。

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java
// The path to the documents directory.
String dataDir = Utils.getDataDir(SetWorksheetTabColor.class);
// Instantiate a new Workbook
Workbook workbook = new Workbook(dataDir + "Book1.xls");
// Get the first worksheet in the book
Worksheet worksheet = workbook.getWorksheets().get(0);
// Set the tab color
worksheet.setTabColor(Color.getRed());
// Save the Excel file
workbook.save(dataDir + "worksheettabcolor.xls");