Set Worksheet Tab Color

Setting Worksheet Tab Color with Microsoft Excel

  1. Right-click a tab in the tab-sheet at the bottom of the current worksheet.
  2. Select Tab color.
  3. Select a color from the palette.
  4. Click OK.

The tabs have been colored red, green and blue

todo:image_alt_text

Setting Worksheet Tab Color with Aspose.Cells

The sample code below shows how to set tab color with 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");