This project has moved. For the latest updates, please go here.

How to Set print Area

Feb 3, 2011 at 7:01 AM

Hello Sir,

            Im Using EPPlus for creating Excel in c#..i created the Excel file Successfully,But i dnt know how to set the Print Area in that excel, can Any one help me to solve this problem.

 

Coordinator
Feb 3, 2011 at 3:20 PM

Hi,

Use the Worksheet.PrinterSettings.PrintArea property. Something like..

ws.PrinterSettings.PrintArea=ws.Cells["A1:B2"];

Jan
Feb 6, 2011 at 12:53 PM
Edited Feb 7, 2011 at 11:09 AM

Thanks for ur Kind Help..

                In that Excel file how to set the Row header in all pages .I tried many things but i dnt get the correct format.

               Im using this statement..

              ws.PrinterSettings.RepeatRows.Address = "6:6";

              im getting this error  "Object reference not to set an instance of an object"...

 

Coordinator
Feb 7, 2011 at 6:53 PM

Hi again,

Try...

 ws.PrinterSettings.RepeatRows=ws.Cells["6:6"];

Jan