配色の配列を使用してブックのカスタムテーマの適用
Contents
[
Hide
]
配色の配列を使用してブックのカスタムテーマの適用
次のサンプルコードは、カスタムテーマの配色を使用してブックに適用する方法を示しています。このコードで生成された 出力エクセルファイル と、そのファイルに対するコードの効果を示すスクリーンショットをご確認ください。
サンプルコード
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-C | |
Aspose::Cells::Startup(); | |
//Output directory path | |
U16String outPath(u"..\\Data\\Output\\"); | |
//Path of output excel file | |
U16String outputApplyCustomThemeColorsOfWorkbookUsingArrayOfColors = outPath + u"outputApplyCustomThemeColorsOfWorkbookUsingArrayOfColors.xlsx"; | |
//Create a workbook | |
Workbook wb; | |
Color Red{ 0xff, 0xff, 0, 0 }; | |
Color Green{ 0xff, 0, 0x80, 0 }; | |
Color Blue{ 0xff, 0, 0, 0xff }; | |
//Create array of custom theme colors | |
Color clrs[12]; | |
//Vector<Aspose::Cells::Color> clrs(12); | |
//Background1 | |
clrs[0] = Red; | |
//Text1 | |
clrs[1] = Red; | |
//Background2 | |
clrs[2] = Red; | |
//Text2 | |
clrs[3] = Red; | |
//Accent1 | |
clrs[4] = Red; | |
//Accent2 | |
clrs[5] = Green; | |
//Accent3 | |
clrs[6] = Green; | |
//Accent4 | |
clrs[7] = Green; | |
//Accent5 | |
clrs[8] = Green; | |
//Accent6 | |
clrs[9] = Blue; | |
//Hyperlink | |
clrs[10] = Blue; | |
//Followed Hyperlink | |
clrs[11] = Blue; | |
//Apply custom theme colors on workbook | |
wb.CustomTheme(u"AnyTheme", Vector<Color>(clrs, 12)); | |
//Save the workbook | |
wb.Save(outputApplyCustomThemeColorsOfWorkbookUsingArrayOfColors); | |
Aspose::Cells::Cleanup(); |