0

I've got this Excel Interop code:

_xlSheetFillRateByDCByLocation.PageSetup.PrintTitleRows = String.Format("${0}:${0}", BYDCBYLOC_HEADING_ROW);

I want to accomplish the same with EPPlus.

I tried this:

locationWorksheet.PrinterSettings.RepeatColumns.Rows = BYDCBYLOC_HEADING_ROW;

...but "RepeatColumns.Rows" is a readonly property, and thus cannot be assigend to.

I found this:

locationWorksheet.PrinterSettings.ShowHeaders = true;

...but I don't know if I'm barking up the wrong tree with that.

What is the analogue in EPPlus to Excel Interop's PrintTitleRows?

B. Clay Shannon-B. Crow Raven
  • 8,547
  • 144
  • 472
  • 862

1 Answers1

1

You just need to give it a proper ExcelAddress object like this:

worksheet.PrinterSettings.RepeatRows = new ExcelAddress("$1:$1");
worksheet.PrinterSettings.RepeatColumns = new ExcelAddress("$A:$A");
Ernie S
  • 13,902
  • 4
  • 52
  • 79
  • When using 'worksheet.PrinterSettings.RepeatRows = new ExcelAddress("$1:$1");' and then attempting to print from within Excel, I am getting the error "print titles must be contiguous and complete rows or columns." Have you heard anything about this issue? – cbrawl May 22 '18 at 17:47