设置工作表标签颜色
Contents
[
Hide
]
Aspose.Cells for Python via .NET允许你更改单个工作表标签的颜色,使其在其他标签中脱颖而出。例如,你可以将“费用”标签设为红色,“销售”绿色,“资产”蓝色等。
如何使用Microsoft Excel设置工作表标签颜色
- 在当前工作表底部的标签工作表上右键单击。
- 选择标签颜色。
- 从调色板中选择一种颜色。
- 点击确定。
如何使用Aspose.Cells for Python Excel库设置工作表标签颜色
以下示例代码展示如何使用Aspose.Cells for Python via .NET设置标签颜色。
This file contains hidden or 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
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") |