Exemplo n.º 1
0
        public void TestSetGetHeaderFooterMargin()
        {
            CT_Worksheet worksheet = new CT_Worksheet();
            CT_PageMargins pMargins = worksheet.AddNewPageMargins();
            pMargins.header = (1.5);
            pMargins.footer = (2);
            XSSFPrintSetup printSetup = new XSSFPrintSetup(worksheet);
            Assert.AreEqual(1.5, printSetup.HeaderMargin, 0.0);
            Assert.AreEqual(2.0, printSetup.FooterMargin, 0.0);

            printSetup.HeaderMargin = (5);
            printSetup.FooterMargin = (3.5);
            Assert.AreEqual(5.0, pMargins.header, 0.0);
            Assert.AreEqual(3.5, pMargins.footer, 0.0);
        }
Exemplo n.º 2
0
        public XSSFPrintSetup(CT_Worksheet worksheet)
        {
            this.ctWorksheet = worksheet;

            if (ctWorksheet.IsSetPageSetup())
            {
                this.pageSetup = ctWorksheet.pageSetup;
            }
            else
            {
                this.pageSetup = ctWorksheet.AddNewPageSetup();
            }
            if (ctWorksheet.IsSetPageMargins())
            {
                this.pageMargins = ctWorksheet.pageMargins;
            }
            else
            {
                this.pageMargins = ctWorksheet.AddNewPageMargins();
            }
        }
Exemplo n.º 3
0
        /**
         * Create a new CT_Worksheet instance with all values set to defaults
         *
         * @return a new instance
         */
        private static CT_Worksheet NewSheet()
        {
            CT_Worksheet worksheet = new CT_Worksheet();
            CT_SheetFormatPr ctFormat = worksheet.AddNewSheetFormatPr();
            ctFormat.defaultRowHeight = (15.0);

            CT_SheetView ctView = worksheet.AddNewSheetViews().AddNewSheetView();
            ctView.workbookViewId = (0);

            worksheet.AddNewDimension().@ref = "A1";

            worksheet.AddNewSheetData();

            CT_PageMargins ctMargins = worksheet.AddNewPageMargins();
            ctMargins.bottom = (0.75);
            ctMargins.footer = (0.3);
            ctMargins.header = (0.3);
            ctMargins.left = (0.7);
            ctMargins.right = (0.7);
            ctMargins.top = (0.75);

            return worksheet;
        }