Free Support Forum - aspose.com

Excel 2007 Themes and Colors

Excel 2007 offers themes and more than the Excel 56 colors. Is there anyway to access the theme attributes of xlsx files or utilize all of the color options within Aspose.Cells?

Thank you.

John


This message was posted using Page2Forum from Colors and Palette - Aspose.Cells for .NET

Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for considering Aspose.

John_Brant:
Excel 2007 offers themes and more than the Excel 56 colors. Is there anyway to access the theme attributes of xlsx files?

We only support to load the theme from the Excel 2007 template file. We will look into the feature to access the themes by API.

John_Brant:
utilize all of the color options within Aspose.Cells?

You can set more than 56 colors of Excel 2003 color palette when saving the file as Excel 2007 file format using Aspose.Cells. Please see the following sample code to set a color which is not a part of 56 Color Palette of Excel 2003.

Workbook workbook = new Workbook();

Style style = workbook.Styles[workbook.Styles.Add()];

// Color not in Excel 2003 56 Color template

style.ForegroundColor = Color.FromArgb(20, 228, 241, 155);

style.Pattern = BackgroundType.Solid;

Cells cells = workbook.Worksheets[0].Cells;

cells["A1"].SetStyle(style);

workbook.Save("C:\\Color_Test.xlsx", FileFormatType.Excel2007Xlsx);

Also, if you want to use any color which is not a part of Excel 2003 Default Color Palette in Excel 2003 file format, you may change the color palette. For details please check the following documentation link:

http://www.aspose.com/documentation/.net-components/aspose.cells-for-.net/colors-and-palette.html

Thank You & Best Regards

Nausherwan,

Thank you for the quick response. Besides the color options, the reason I asked about themes is with Excel 2007, if a cell attribute such as background color is based on the theme (or a shade variance thereof), when the theme changes then, of course, the background color of the cell will change with the theme.

This would be a nice feature to have.

Thanks again.

John

Hi John,

Please try the attached version.

We have added a few methods to support the theme color.

Style.ForegroundThemeColor --> set the foreground color.
Style.BackgroundThemeColor --> set the background color.
Font.ThemeColor --> set the font color.

Workbook.GetThemeColor --> get a theme color.
Workbook.SetThemeColor --> set a theme color.
Workbook.CustomTheme --> Sets all theme colors.


Thank you.


Thank you.