设置工作表标签颜色

如何使用Microsoft Excel设置工作表标签颜色

  1. 在当前工作表底部的标签工作表上右键单击。
  2. 选择标签颜色
  3. 从调色板中选择一种颜色。
  4. 点击确定

如何使用Aspose.Cells for Python Excel库设置工作表标签颜色

以下示例代码展示如何使用Aspose.Cells for Python via .NET设置标签颜色。

from aspose.cells import Workbook
from aspose.pydrawing import Color
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET
# The path to the documents directory.
dataDir = RunExamples.GetDataDir(".")
# Instantiate a new Workbook
# Open an Excel file
workbook = Workbook(dataDir + "Book1.xlsx")
# Get the first worksheet in the book
worksheet = workbook.worksheets[0]
# Set the tab color
worksheet.tab_color = Color.red
# Save the Excel file
workbook.save(dataDir + "worksheettabcolor.out.xls")