本文整理汇总了C#中Workbook.SetThemeColor方法的典型用法代码示例。如果您正苦于以下问题:C# Workbook.SetThemeColor方法的具体用法?C# Workbook.SetThemeColor怎么用?C# Workbook.SetThemeColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Workbook
的用法示例。
在下文中一共展示了Workbook.SetThemeColor方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Run
public static void Run()
{
// ExStart:1
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// Instantiate Workbook object.
// Open an exiting excel file.
Workbook workbook = new Workbook(dataDir + "book1.xlsx");
// Get the Background1 theme color.
Color c = workbook.GetThemeColor(ThemeColorType.Background1);
// Print the color.
Console.WriteLine("theme color Background1: " + c);
// Get the Accent2 theme color.
c = workbook.GetThemeColor(ThemeColorType.Accent2);
// Print the color.
Console.WriteLine("theme color Accent2: " + c);
// Change the Background1 theme color.
workbook.SetThemeColor(ThemeColorType.Background1, Color.Red);
// Get the updated Background1 theme color.
c = workbook.GetThemeColor(ThemeColorType.Background1);
// Print the updated color for confirmation.
Console.WriteLine("theme color Background1 changed to: " + c);
// Change the Accent2 theme color.
workbook.SetThemeColor(ThemeColorType.Accent2, Color.Blue);
// Get the updated Accent2 theme color.
c = workbook.GetThemeColor(ThemeColorType.Accent2);
// Print the updated color for confirmation.
Console.WriteLine("theme color Accent2 changed to: " + c);
// Save the updated file.
workbook.Save(dataDir + "output.out.xlsx");
// ExEnd:1
}
示例2: Main
public static void Main(string[] args)
{
// The path to the documents directory.
string dataDir = Path.GetFullPath("../../../Data/");
//Instantiate Workbook object.
//Open an exiting excel file.
Workbook workbook = new Workbook(dataDir + "book1.xlsx");
//Get the Background1 theme color.
Color c = workbook.GetThemeColor(ThemeColorType.Background1);
//Print the color.
Console.WriteLine("theme color Background1: " + c);
//Get the Accent2 theme color.
c = workbook.GetThemeColor(ThemeColorType.Accent2);
//Print the color.
Console.WriteLine("theme color Accent2: " + c);
//Change the Background1 theme color.
workbook.SetThemeColor(ThemeColorType.Background1, Color.Red);
//Get the updated Background1 theme color.
c = workbook.GetThemeColor(ThemeColorType.Background1);
//Print the updated color for confirmation.
Console.WriteLine("theme color Background1 changed to: " + c);
//Change the Accent2 theme color.
workbook.SetThemeColor(ThemeColorType.Accent2, Color.Blue);
//Get the updated Accent2 theme color.
c = workbook.GetThemeColor(ThemeColorType.Accent2);
//Print the updated color for confirmation.
Console.WriteLine("theme color Accent2 changed to: " + c);
//Save the updated file.
workbook.Save(dataDir + "output.xlsx");
}