Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fit All column on one page with EPPLUS c#

Tags:

c#

epplus

I want to set printer setting Fit All column on one page with epplus. Can any on please help.

My code:

Worksheet.PrinterSettings.PaperSize = ePaperSize.A4;
Worksheet.PrinterSettings.Orientation = eOrientation.Landscape;
Worksheet.PrinterSettings.FitToPage = true;

Worksheet.PrinterSettings.FitToWidth = 1;
like image 457
Amol Naik Avatar asked Aug 02 '18 09:08

Amol Naik


Video Answer


1 Answers

I think it's a bit counter intuitive but you also have to set worksheet.PrinterSettings.FitToHeight = 0 in order for this to work.

This is the code I usually use when setting up a worksheet for printing:

worksheet.PrinterSettings.PaperSize = ePaperSize.A4;
worksheet.PrinterSettings.Orientation = eOrientation.Portrait;
worksheet.PrinterSettings.HorizontalCentered = true;
worksheet.PrinterSettings.FitToPage = true;
worksheet.PrinterSettings.FitToWidth = 1;
worksheet.PrinterSettings.FitToHeight = 0;
like image 70
PRKNS Avatar answered Oct 17 '22 14:10

PRKNS