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.

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-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// Instantiate a new Workbook
// Open an Excel file
Workbook workbook = new Workbook(dataDir+ "Book1.xlsx");
// Get the first worksheet in the book
Worksheet worksheet = workbook.Worksheets[0];
// Set the tab color
worksheet.TabColor = Color.Red;
// Save the Excel file
workbook.Save(dataDir+ "worksheettabcolor.out.xls");