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

Printer settings doesn't work

Jun 11, 2015 at 5:16 PM
Edited Jun 11, 2015 at 5:17 PM
I have the following function:
    private void SetDetailPrintSettings(Excel.ExcelWorksheet sheet, int rows)
        sheet.PrinterSettings.Orientation = Excel.eOrientation.Landscape;
        sheet.PrinterSettings.Scale = 46;
        sheet.PrinterSettings.PrintArea = sheet.Cells[1, 1, rows, 22];
        sheet.PrinterSettings.FitToPage = true;
        sheet.PrinterSettings.FitToWidth = 0;

I call it for each sheet in my spreadsheet. It doesn't seem to be doing anything. How do I set the printer settings? To elaborate, most obviously, it doesn't set the sheet as landscape, it doesn't set the scale, it doesn't set the print area, etc.
Jun 11, 2015 at 5:21 PM
Nevermind. Works just fine. As soon as I posted this, I was reviewing the code some more and realized it was the function calling this that had the problem. It was passing the wrong sheet in.