There is also such line in Release notes:
· IHFEngine interface has been added to create/edit strings required by header/footer...
Using this object you can work with header/footer without knowing a lot about MS Excel header/footer string format.
IHFEngine hfEngine = book.CreateHFEngine();
hfEngine.Text = "ArialRegular ItalicBold";
IFont font = book.CreateFont();
font.FontName = "Arial";
hfEngine.SetFont( 0, 12, font );
font = book.CreateFont();
font.FontName = "Arial";
font.Italic = true;
font.Bold = true;
hfEngine.SetFont( 13, 18, font );
pageSetup.CenterHeader = hfEngine.GetHeaderFooterString();
Hi
I attempted to implement this code for 2 lines of my header but the full header always ends up only as the second part of the font definition. (size 12 etc)
int line1 = System.Web.HttpContext.GetGlobalResourceObject("Excel", "CenterHeader").ToString().Length;
int line2 = System.Web.HttpContext.GetGlobalResourceObject("Excel", "CHeader").ToString().Length;
IHFEngine hfEngine = workbook.CreateHFEngine();
hfEngine.Text = cheader;
IFont font = workbook.CreateFont();
font.FontName = "Arial";
font.Size =18;
font.Bold = true;
font.Underline = Syncfusion.XlsIO.ExcelUnderline.Single;
hfEngine.SetFont(0, line1, font);
font.FontName = "Arial";
font.Bold = false;
font.Size = 12;
font.Underline = Syncfusion.XlsIO.ExcelUnderline.None;
hfEngine.SetFont(line1+1,cheader.Length, font);
worksheet.PageSetup.CenterHeader = hfEngine.GetHeaderFooterString();
Attached is the resx file the texts are being taken from
Regards
Meir
Hi
Thanks this now works. My only other issue with header/footer is how to define a Header/Footer for page 1 and no header for the other pages.
Looking forward to your swift response
Regards
Meir Rotfleisch