This project has moved and is read-only. For the latest updates, please go here.

RepeatRows & RepeatColumns don't work

Apr 13, 2011 at 2:35 PM


I want to repeat the first rows and columns on each pages on printing.

I tried this : 

ws.PrinterSettings.RepeatRows = ws.Cells["1:2"];
ws.PrinterSettings.RepeatColumns = ws.Cells["A:G"];

and this :

ws.PrinterSettings.RepeatRows = new ExcelAdress("1:2");
ws.PrinterSettings.RepeatColumns = new ExcelAdress("A:G");

That don't work...

How to do this ?


Apr 14, 2011 at 3:02 PM


Worked fine for me.

Pasted this into sample 1...

worksheet.PrinterSettings.RepeatRows = worksheet.Cells["1:2"];
worksheet.PrinterSettings.RepeatColumns = worksheet.Cells["A:G"];
Can you provide a more detailed example?
Oct 23, 2012 at 12:03 PM
Edited Oct 23, 2012 at 12:06 PM


I am experiencing an error with the 'RepeatRows' property too. When I try this:

sheet.PrinterSettings.RepeatRows = sheet.Cells["1:1"];
sheet.PrinterSettings.RepeatColumns = sheet.Cells["A:D"];

I receive the error message bellow:

ArgumentOutOfRangeException: Row cannot be less then 1.
Parameter name: value
OfficeOpenXml.ExcelCellAddress.set_Row(Int32 value) +97
OfficeOpenXml.ExcelCellAddress..ctor(Int32 row, Int32 column) +45
OfficeOpenXml.ExcelAddressBase.get_Start() +71
OfficeOpenXml.ExcelPrinterSettings.get_RepeatColumns() +120
OfficeOpenXml.ExcelPrinterSettings.set_RepeatRows(ExcelAddress value) +157

I am using EPPlus version


Apr 26, 2014 at 3:40 AM
Edited Apr 26, 2014 at 3:41 AM
jankallman wrote:
Hi, Worked fine for me.
It's still broken in last build (commit 0ad4f8d82b0c of 2014-04-20). The problem seems to be that the setter for ExcelCellAddress.Row doesn't like column-only addresses like "A:D". The Start (and probably End) getter(s) of ExcelAddressBase should probably treat those addresses differently from "normal" range addresses. Just my 2 (Euro-)cents.