Set Worksheet Tab Color
Contents
[
Hide
]
Aspose.Cells allows you to change the color of individual worksheet tabs to make them prominent from the rest. For example, you can make Expenses red, Sales green, Assets blue, etc.
Setting Worksheet Tab Color with Microsoft Excel
- Right-click a tab in the tab-sheet at the bottom of the current worksheet.
- Select Tab color.
- Select a color from the palette.
- Click OK.
The tabs have been colored red, green and blue
Setting Worksheet Tab Color with Aspose.Cells
The sample code below shows how to set tab color with Aspose.Cells.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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"); |