@@ -18,17 +18,25 @@ static void Main(string[] args)
1818 //Adding values in worksheet
1919 worksheet . Range [ "A1:A600" ] . Text = "HelloWorld" ;
2020
21- //Adding text with formatting to page headers
21+ //Adding text with red color formatting to the left header
2222 worksheet . PageSetup . LeftHeader = "&KFF0000 Left Header" ;
23- worksheet . PageSetup . CenterHeader = "&KFF0000 Center Header" ;
24- worksheet . PageSetup . RightHeader = "&KFF0000 Right Header" ;
2523
26- //Adding text with formatting and image to page footers
24+ //Adding text (sheet name) with red color formatting to the center header
25+ worksheet . PageSetup . CenterHeader = "&KFF0000&A" ;
26+
27+ //Adding text (date and time) with red color formatting to the right header
28+ worksheet . PageSetup . RightHeader = "&KFF0000&D &T" ;
29+
30+ //Adding bold text, font size 18, and blue color formatting to the left footer
2731 worksheet . PageSetup . LeftFooter = "&B &18 &K0000FF Left Footer" ;
32+
33+ //Adding an image placeholder to the center footer
2834 FileStream imageStream = new FileStream ( Path . GetFullPath ( @"Data/image.jpg" ) , FileMode . Open ) ;
2935 worksheet . PageSetup . CenterFooter = "&G" ;
3036 worksheet . PageSetup . CenterFooterImage = Image . FromStream ( imageStream ) ;
31- worksheet . PageSetup . RightFooter = "&P &K0000FF Right Footer" ;
37+
38+ //Adding the file name to the right footer with blue color formatting
39+ worksheet . PageSetup . RightFooter = "&K0000FF&F" ;
3240
3341 //Saving the workbook as stream
3442 FileStream stream = new FileStream ( Path . GetFullPath ( "Output/Output.xlsx" ) , FileMode . Create ) ;
0 commit comments