Programatically set Rows to repeat for excel sheet

Hi Experts,

I am trying to progrmatically set an excel file through C# to print the header row on each page.
I am setting various properties, but can't seem to find one that will do this.

In excel it can be set by going to File - Page Setup - Sheet tab - Rows to repeat at top: 1:1

How can this be done through C#.

Thanks in advance.
ksedranAsked:
Who is Participating?
 
zorvek (Kevin Jones)Connect With a Mentor ConsultantCommented:
I can't provide the exact C# syntax, but the property you want is:

   oSheet.PageSetup.PrintTitleRows = "$1:$1"

Kevin
0
 
Éric MoreauSenior .Net ConsultantCommented:
record a macro in Excel. it provides almost the exact required code.
0
 
ksedranAuthor Commented:
Thanks zorvek.

That did it.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.