Esempio n. 1
0
        /// <summary>
        /// Définition des zones d'impression
        /// </summary>
        /// <param name="_sheet"></param>
        /// <param name="_msgCenter"></param>
        /// <param name="_scale"></param>
        private void definePrintSetup(HSSFSheet _sheet, string _msgCenter, short _scale)
        {
            HSSFFooter footer = (HSSFFooter)_sheet.Footer;
            //you can set right, left, and center footers
            footer.Center = _msgCenter;
            footer.Right = "Page " + HSSFFooter.Page + "         ";

            HSSFPrintSetup print = (HSSFPrintSetup)_sheet.PrintSetup;
            print.Landscape = true;
            //print scale is scale in % – here I’m doing 70%

            print.Scale = _scale;

            _sheet.SetMargin(NPOI.SS.UserModel.MarginType.TopMargin, (double).50);
            //the bottom margin needs to be larger to accommodate my footer text
            _sheet.SetMargin(NPOI.SS.UserModel.MarginType.BottomMargin, (double)1.00);
            _sheet.SetMargin(NPOI.SS.UserModel.MarginType.LeftMargin, (double).50);
            _sheet.SetMargin(NPOI.SS.UserModel.MarginType.RightMargin, (double).50);
        }