当前位置: 首页>>代码示例>>C#>>正文


C# Workbook.SetThemeColor方法代码示例

本文整理汇总了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

        }
开发者ID:aspose-cells,项目名称:Aspose.Cells-for-.NET,代码行数:45,代码来源:GetSetThemeColors.cs

示例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");
        }
开发者ID:mmunchandersen,项目名称:Aspose_Cells_NET,代码行数:42,代码来源:Program.cs


注:本文中的Workbook.SetThemeColor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。