设置工作表标签颜色
Contents
[
Hide
]
Aspose.Cells 允许您更改单个工作表选项卡的颜色,使它们在其余部分中突出显示。例如,您可以使费用为红色、销售为绿色、资产为蓝色等。
使用 Microsoft Excel 设置工作表选项卡颜色
- 右键单击当前工作表底部选项卡中的选项卡。
- 选择标签颜色.
- 从调色板中选择一种颜色。
- 点击好的.
选项卡已着色为红色、绿色和蓝色
使用 Aspose.Cells 设置工作表选项卡颜色
下面的示例代码显示了如何使用 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"); |