C # page settings during printing
Using Excel = Microsoft. Office. Interop. Excel;
Excel. Application tmpExcel = new Excel. ApplicationClass ();
Excel. workbook tmpbook = tmpExcel. workbooks. open (tmppath, Type. missing, Type. missing, Type. missing, Type. missing, Type. missing, Type. missing, Type. missing, Type. missing, Type. missing, Type. missing, Type. missing, Type. missing, Type. missing, Type. missing); // table permission settings, such as read-only, password, and permission
// Add a new sheet
Excel. Worksheet objsheet = (Excel. Worksheet) tmpbook. Worksheets. Add (Type. Missing, Type. Missing, Type. Missing );
Objsheet. PageSetup. Orientation = XlPageOrientation. xlLandscape; // horizontal Orientation of the page
Objsheet. PageSetup. Zoom = false; // set the page when printing. It must be set to false. The page width is valid only when the following two rows are high.
Objsheet. PageSetup. FitToPagesTall = 1; // page height
Objsheet. PageSetup. FitToPagesWide = 1; // page width
Objsheet. PageSetup. Zoom = 75; // when printing, set the page and Zoom ratio.
Objsheet. PageSetup. TopMargin = 0; // The top margin is 0.
Objsheet. PageSetup. BottomMargin = 0; // The bottom margin is 0.
Objsheet. PageSetup. LeftMargin = 0; // The left margin is 0.
Objsheet. PageSetup. RightMargin = 0; // The right margin is 0.
Objsheet. PageSetup. CenterHorizontally = true; // horizontally centered
From brian0031