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;
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;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With