Hi,
This is the command syntax that will be used to set header and footer with different fonts and colors.
&”,”&KYOURTEXT
So in C#,
It will be like this
String script=”&\”Arial, Bold\”&KFF00FFThis is your Text”
In the code below, 0 means left side section of the header, 1 means center side of header and 2 means right side of header.
I have set the left section in red color, center section in green color and right section in blue color.
Each section has been set in different fonts. Same thing was repeated with footer text.
Please see the screenshot to see how the output looks.
C#
Workbook excel = new Workbook();
Aspose.Cells.PageSetup pageSetup = excel.Worksheets[0].PageSetup;
//Script
String script0 = “&“Calibri, Bold”&KFF0000Red - Left Calibri”;
String script1 = “&“Verdana, Bold”&K00FF00Green - Center Verdana”;
String script2 = “&“Courier New, Bold”&K0000FFBlue - Right Courier”;
pageSetup.SetHeader(0, script0);
pageSetup.SetHeader(1, script1);
pageSetup.SetHeader(2, script2);
pageSetup.SetFooter(0, script0);
pageSetup.SetFooter(1, script1);
pageSetup.SetFooter(2, script2);
excel.Save(@“f:\downloads\output.xlsx”);