应用高级条件格式
Contents
[
Hide
]
Microsoft Excel 2007 年及以后的版本(2010/2013/2016)提供了一些高级的条件格式功能。例如,它允许您应用单元格底纹、边框、彩色图标、箭头、旗帜以及字体格式等。这些功能已经变得非常复杂。
将高级条件格式应用于 Microsoft Excel 文件
条件格式可以:
- 使用数据条以图形化方式增强单元格中的基础数字,通过在单元格中嵌入简单的条形图。
- 根据它们与范围内其他单元格中的值的关系自动通过颜色比例给单元格着色。默认设置将最低值以红色着色,向上转为最高值以绿色着色。
- 以与颜色比例类似的方式使用图标集,但与给单元格着色不同,它向单元格中添加小图标,如箭头和交通灯。
Aspose.Cells 在运行时完全支持 Microsoft Excel 2007 年及以后版本在 XLSX 格式中提供的条件格式。此示例演示了包括图标集、数据条、颜色比例、时间周期、前/后和其他规则在内的高级条件格式类型的实参练习。
- Adding Color Scale Conditional Formattings
- Adding Above Average Conditional Formattings
- Adding DataBars Conditional Formattings
- Adding IonSets Conditional Formattings
- Adding Text Conditional Formattings
- Adding TimePeriods Conditional Formattings
- Adding Top10 Conditional Formattings
计算 Microsoft Excel 为 ColorScale 条件格式选择的颜色
Aspose.Cells允许您在模板文件中使用ColorScale条件格式化时计算Microsoft Excel选择的颜色。请参阅下面的示例代码,了解如何计算Microsoft Excel选择的颜色。
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
// 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 workbook object | |
// Open the template file | |
Workbook workbook = new Workbook(dataDir + "Book1.xlsx"); | |
// Get the first worksheet | |
Worksheet worksheet = workbook.Worksheets[0]; | |
// Get the A1 cell | |
Cell a1 = worksheet.Cells["A1"]; | |
// Get the conditional formatting resultant object | |
ConditionalFormattingResult cfr1 = a1.GetConditionalFormattingResult(); | |
// Get the ColorScale resultant color object | |
Color c = cfr1.ColorScaleResult; | |
// Read the color | |
Console.WriteLine(c.ToArgb().ToString()); | |
Console.WriteLine(c.Name); |