Set Worksheet Tab Color in Xlsx4j

Aspose.Cells - Set Worksheet Tab Color

Aspose.Cells allows you to change the color of individual worksheet tabs to make them more prominent than the rest. For example, you can make Expenses red, Sales green, Assets blue, etc.

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.

Java

  

 //Instantiate a new Workbook  

Workbook workbook = new Workbook(dataDir + "workbook.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 + "AsposeColoredTab_Out.xls");  

Download Running Code

Download Sample Code