Workbook.SetThemeColor

Workbook.SetThemeColor method

Sets the theme color

public void SetThemeColor(ThemeColorType type, Color color)
ParameterTypeDescription
typeThemeColorTypeThe theme color type.
colorColorthe theme color

Examples

using System;
using System.Drawing;
using Aspose.Cells;

namespace AsposeCellsExamples
{
    public class WorkbookMethodSetThemeColorWithThemeColorTypeColorDemo
    {
        public static void Run()
        {
            // Create a new workbook
            Workbook workbook = new Workbook();
            
            // Set theme color for Text1 to Green
            workbook.SetThemeColor(ThemeColorType.Text1, Color.Green);
            
            // Apply the theme color to default style
            Style style = workbook.DefaultStyle;
            style.Font.ThemeColor = new ThemeColor(ThemeColorType.Text1, 0);
            workbook.DefaultStyle = style;
            
            // Save the workbook
            workbook.Save("output.xlsx");
            
            Console.WriteLine("Workbook with theme color saved successfully.");
        }
    }
}

See Also