Header/Footer Font Color

Hi -

I know I can change the font type and style in the header, however can i change the actual font color?

Thanks

Hi,

Thanks for considering Aspose.

Well, Changing font color in headers/footers is not supported yet, we may consider it in future.

Regards

Amjad Sahi

Aspose Nanjing Team

Yes, we don’t support to set header/footer font color. But this is not a limitation of Aspose.Cells, but MS Excel. You can verify it in MS Excel. It doesn’t support this feature. So we cannot support it.

Sorry to resurrect a topic as old as this, but has there been any updates in this area now that excel 2007 and 2010 has been released?

Hi,

Please create some Xls or Xlsx file manually with Microsoft Excel with your desired output. I will check it with latest version of Aspose.Cells for .NET. In case, if the feature is available, I will provide you a code example for it.

Here is an example of changing font color in a header. Many thanks, Mr. Faiz.

Hi,

Thanks for providing us the template file which does have the header text with different (in Red) color.

There is a limitation for XLS file format (Excel 97-2003) that does not support to perform this task in it. But, in MS Excel 2007 XLSX file format, it is supported.

I have logged your request into our issue tracking system with an id: CELLSNET-24240. We will look into it and get back to you soon.

Thank you.

Hi,

If you want to set the font color of the header and footer, please use &K. See following codes:

C#

Workbook excel = new Workbook();


Aspose.Cells.PageSetup pageSetup = excel.Worksheets[0].PageSetup;


//Setting current date and current time at the centeral section of the header

//and changing the font with color in the header

pageSetup.SetHeader(1, “&“Calibri,Regular”&11Change Font “Calibri,Regular,Red”&11Color&“Calibri,Regular”&11 in Header Example”);

pageSetup.SetHeader(2, “&“Times New Roman,Bold”&KFF0000&D-&T”);

excel.Save(@“D:\FileTemp\dest.xlsx”);



Hi,

As Shakeel Faiz has suggested you to use &K command for font color, so the complete sample code for your need (according to your sample Excel file(having your desired header)) would be (I will correct the previous code):

Workbook excel = new Workbook();

Aspose.Cells.PageSetup pageSetup = excel.Worksheets[0].PageSetup;

//Setting current date and current time at the central section of the header
//and changing the font with color in the header- hexadecimal value 000000 -> black and FF0000 -> red
pageSetup.SetHeader(1, “&“Calibri,Regular”&11&K000000Change Font&KFF0000 Color&“Calibri,Regular”&11&K000000 in Header Example”);
pageSetup.SetHeader(2, “&“Times New Roman,Bold”&KFF0000&D-&T”);
excel.Save(@“e:\test2\dest.xlsx”);


Thank you.

Hi,

Also refer to this thread for more clarification and output screenshot.

Setting font, color for header and footer text.