C # print page settings (horizontal, page width, page height)

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.