Excel sheet headers using EPPlus

I use EPPLus to create and format an excel sheet from my dataset. I want to set the headers on an Excel worksheet using EPPlus. I could not find a way to do this. I want to set the left title, right title and center title. I did this using VBA code, but I decided to give up on this. In VBA, I just did

With ActiveSheet.PageSetup
.LeftHeader = ""
.RightHeader =""
.CenterHeader= ""
End With

Help!! Thanks

PS: I am creating a winforms application. I was not sure that this would change anything, but I just wanted to mention it here. Thanks

+5
source share
1 answer

I finally figured it out.

It can be done using 
workSheet.HeaderFooter.FirstHeader.LeftAlignedText = ""
workSheet.HeaderFooter.FirstHeader.RightAlignedText = ""
workSheet.HeaderFooter.FirstHeader.CenterAlignedText = ""

This sets up for the first page. Changing the property FirstHeaderto EvenHeaderand is OddHeaderset if for the following pages.

differentFirst differentOddEven, , . , false . .

,

+11

All Articles