Пример #1
0
        public void TestSetGetPageStart()
        {
            CT_Worksheet worksheet = new CT_Worksheet();
            CT_PageSetup pSetup = worksheet.AddNewPageSetup();
            pSetup.firstPageNumber = 9;
            XSSFPrintSetup printSetup = new XSSFPrintSetup(worksheet);
            Assert.AreEqual(9, printSetup.PageStart);

            printSetup.PageStart = ((short)1);
            Assert.AreEqual((uint)1, pSetup.firstPageNumber);
        }
Пример #2
0
        public void TestSetGetScale()
        {
            CT_Worksheet worksheet = new CT_Worksheet();
            CT_PageSetup pSetup = worksheet.AddNewPageSetup();
            pSetup.scale = (uint)9;
            XSSFPrintSetup printSetup = new XSSFPrintSetup(worksheet);
            Assert.AreEqual(9, printSetup.Scale);

            printSetup.Scale = ((short)100);
            Assert.AreEqual((uint)100, pSetup.scale);
        }
Пример #3
0
        public void TestSetGetDraft()
        {
            CT_Worksheet worksheet = new CT_Worksheet();
            CT_PageSetup pSetup = worksheet.AddNewPageSetup();
            pSetup.draft = (false);
            XSSFPrintSetup printSetup = new XSSFPrintSetup(worksheet);
            Assert.AreEqual(false, printSetup.Draft);

            printSetup.Draft = (true);
            Assert.AreEqual(true, pSetup.draft);
        }
Пример #4
0
        public void TestSetGetCopies()
        {
            CT_Worksheet worksheet = new CT_Worksheet();
            CT_PageSetup pSetup = worksheet.AddNewPageSetup();
            pSetup.copies = (9);
            XSSFPrintSetup printSetup = new XSSFPrintSetup(worksheet);
            Assert.AreEqual(9, printSetup.Copies);

            printSetup.Copies = (short)15;
            Assert.AreEqual((uint)15, pSetup.copies);
        }
Пример #5
0
        public void TestSetLandscapeFalse()
        {
            XSSFPrintSetup ps = new XSSFPrintSetup(new CT_Worksheet());

            Assert.IsFalse(ps.Landscape);

            ps.Landscape = (true);
            Assert.IsTrue(ps.Landscape);

            ps.Landscape = (false);
            Assert.IsFalse(ps.Landscape);
        }
Пример #6
0
        public void TestSetLeftToRight()
        {
            XSSFPrintSetup ps = new XSSFPrintSetup(new CT_Worksheet());

            Assert.IsFalse(ps.LeftToRight);

            ps.LeftToRight = (true);
            Assert.IsTrue(ps.LeftToRight);

            ps.LeftToRight = (false);
            Assert.IsFalse(ps.LeftToRight);
        }
Пример #7
0
        public void TestSetGetPaperSize()
        {
            CT_Worksheet worksheet = new CT_Worksheet();
            CT_PageSetup pSetup = worksheet.AddNewPageSetup();
            pSetup.paperSize = (9);
            XSSFPrintSetup printSetup = new XSSFPrintSetup(worksheet);
            Assert.AreEqual(PaperSize.A4, printSetup.GetPaperSizeEnum());
            Assert.AreEqual(9, printSetup.PaperSize);

            printSetup.SetPaperSize(PaperSize.A3);
            Assert.AreEqual((uint)8, pSetup.paperSize);
        }
Пример #8
0
        public void TestSetGetLeftToRight()
        {
            CT_Worksheet worksheet = new CT_Worksheet();
            CT_PageSetup pSetup    = worksheet.AddNewPageSetup();

            pSetup.pageOrder = (ST_PageOrder.downThenOver);
            XSSFPrintSetup printSetup = new XSSFPrintSetup(worksheet);

            Assert.AreEqual(false, printSetup.LeftToRight);

            printSetup.LeftToRight = (true);
            Assert.AreEqual(PageOrder.OVER_THEN_DOWN.Value, (int)pSetup.pageOrder);
        }
Пример #9
0
        public void TestSetGetUsePage()
        {
            CT_Worksheet worksheet = new CT_Worksheet();
            CT_PageSetup pSetup    = worksheet.AddNewPageSetup();

            pSetup.useFirstPageNumber = (false);
            XSSFPrintSetup printSetup = new XSSFPrintSetup(worksheet);

            Assert.AreEqual(false, printSetup.UsePage);

            printSetup.UsePage = (true);
            Assert.AreEqual(true, pSetup.useFirstPageNumber);
        }
Пример #10
0
        public void TestSetGetValidSettings()
        {
            CT_Worksheet worksheet = new CT_Worksheet();
            CT_PageSetup pSetup    = worksheet.AddNewPageSetup();

            pSetup.usePrinterDefaults = (false);
            XSSFPrintSetup printSetup = new XSSFPrintSetup(worksheet);

            Assert.AreEqual(false, printSetup.ValidSettings);

            printSetup.ValidSettings = (true);
            Assert.AreEqual(true, pSetup.usePrinterDefaults);
        }
Пример #11
0
        public void TestSetGetDraft()
        {
            CT_Worksheet worksheet = new CT_Worksheet();
            CT_PageSetup pSetup    = worksheet.AddNewPageSetup();

            pSetup.draft = (false);
            XSSFPrintSetup printSetup = new XSSFPrintSetup(worksheet);

            Assert.AreEqual(false, printSetup.Draft);

            printSetup.Draft = (true);
            Assert.AreEqual(true, pSetup.draft);
        }
Пример #12
0
        public void TestSetGetCopies()
        {
            CT_Worksheet worksheet = new CT_Worksheet();
            CT_PageSetup pSetup    = worksheet.AddNewPageSetup();

            pSetup.copies = (9);
            XSSFPrintSetup printSetup = new XSSFPrintSetup(worksheet);

            Assert.AreEqual(9, printSetup.Copies);

            printSetup.Copies = (short)15;
            Assert.AreEqual((uint)15, pSetup.copies);
        }
Пример #13
0
        public void TestSetGetNotes()
        {
            CT_Worksheet worksheet = new CT_Worksheet();
            CT_PageSetup pSetup    = worksheet.AddNewPageSetup();

            pSetup.cellComments = ST_CellComments.none;
            XSSFPrintSetup printSetup = new XSSFPrintSetup(worksheet);

            Assert.AreEqual(false, printSetup.Notes);

            printSetup.Notes = true;
            Assert.AreEqual(PrintCellComments.AS_DISPLAYED.Value, (int)pSetup.cellComments);
        }
Пример #14
0
        public void TestSetGetScale()
        {
            CT_Worksheet worksheet = new CT_Worksheet();
            CT_PageSetup pSetup    = worksheet.AddNewPageSetup();

            pSetup.scale = (uint)9;
            XSSFPrintSetup printSetup = new XSSFPrintSetup(worksheet);

            Assert.AreEqual(9, printSetup.Scale);

            printSetup.Scale = ((short)100);
            Assert.AreEqual((uint)100, pSetup.scale);
        }
Пример #15
0
        public void TestSetGetNoColor()
        {
            CT_Worksheet worksheet = new CT_Worksheet();
            CT_PageSetup pSetup    = worksheet.AddNewPageSetup();

            pSetup.blackAndWhite = (false);
            XSSFPrintSetup printSetup = new XSSFPrintSetup(worksheet);

            Assert.AreEqual(false, printSetup.NoColor);

            printSetup.NoColor = true;
            Assert.AreEqual(true, pSetup.blackAndWhite);
        }
Пример #16
0
        public void TestSetGetPageStart()
        {
            CT_Worksheet worksheet = new CT_Worksheet();
            CT_PageSetup pSetup    = worksheet.AddNewPageSetup();

            pSetup.firstPageNumber = 9;
            XSSFPrintSetup printSetup = new XSSFPrintSetup(worksheet);

            Assert.AreEqual(9, printSetup.PageStart);

            printSetup.PageStart = ((short)1);
            Assert.AreEqual((uint)1, pSetup.firstPageNumber);
        }
Пример #17
0
        public void TestSetGetPaperSize()
        {
            CT_Worksheet worksheet = new CT_Worksheet();
            CT_PageSetup pSetup    = worksheet.AddNewPageSetup();

            pSetup.paperSize = (9);
            XSSFPrintSetup printSetup = new XSSFPrintSetup(worksheet);

            Assert.AreEqual(PaperSize.A4, printSetup.GetPaperSizeEnum());
            Assert.AreEqual(9, printSetup.PaperSize);

            printSetup.SetPaperSize(PaperSize.A3);
            Assert.AreEqual((uint)8, pSetup.paperSize);
        }
Пример #18
0
        public void TestSetGetFitWidthHeight()
        {
            CT_Worksheet worksheet = new CT_Worksheet();
            CT_PageSetup pSetup = worksheet.AddNewPageSetup();
            pSetup.fitToWidth = (50);
            pSetup.fitToHeight = (99);
            XSSFPrintSetup printSetup = new XSSFPrintSetup(worksheet);
            Assert.AreEqual(50, printSetup.FitWidth);
            Assert.AreEqual(99, printSetup.FitHeight);

            printSetup.FitWidth = ((short)66);
            printSetup.FitHeight = ((short)80);
            Assert.AreEqual((uint)66, pSetup.fitToWidth);
            Assert.AreEqual((uint)80, pSetup.fitToHeight);
        }
Пример #19
0
        public void TestSetGetFitWidthHeight()
        {
            CT_Worksheet worksheet = new CT_Worksheet();
            CT_PageSetup pSetup    = worksheet.AddNewPageSetup();

            pSetup.fitToWidth  = (50);
            pSetup.fitToHeight = (99);
            XSSFPrintSetup printSetup = new XSSFPrintSetup(worksheet);

            Assert.AreEqual(50, printSetup.FitWidth);
            Assert.AreEqual(99, printSetup.FitHeight);

            printSetup.FitWidth  = ((short)66);
            printSetup.FitHeight = ((short)80);
            Assert.AreEqual((uint)66, pSetup.fitToWidth);
            Assert.AreEqual((uint)80, pSetup.fitToHeight);
        }
Пример #20
0
        public void TestSetGetOrientation()
        {
            CT_Worksheet worksheet = new CT_Worksheet();
            CT_PageSetup pSetup    = worksheet.AddNewPageSetup();

            pSetup.orientation = (ST_Orientation.portrait);
            XSSFPrintSetup printSetup = new XSSFPrintSetup(worksheet);

            Assert.AreEqual(PrintOrientation.PORTRAIT, printSetup.Orientation);
            Assert.AreEqual(false, printSetup.Landscape);
            Assert.AreEqual(false, printSetup.NoOrientation);

            printSetup.Orientation = (PrintOrientation.LANDSCAPE);
            Assert.AreEqual((int)pSetup.orientation, printSetup.Orientation.Value);
            Assert.AreEqual(true, printSetup.Landscape);
            Assert.AreEqual(false, printSetup.NoOrientation);
        }
Пример #21
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);
        }
Пример #22
0
        public void TestSetGetHVResolution()
        {
            CT_Worksheet worksheet = new CT_Worksheet();
            CT_PageSetup pSetup    = worksheet.AddNewPageSetup();

            pSetup.horizontalDpi = (120);
            pSetup.verticalDpi   = (100);
            XSSFPrintSetup printSetup = new XSSFPrintSetup(worksheet);

            Assert.AreEqual(120, printSetup.HResolution);
            Assert.AreEqual(100, printSetup.VResolution);

            printSetup.HResolution = ((short)150);
            printSetup.VResolution = ((short)130);
            Assert.AreEqual((uint)150, pSetup.horizontalDpi);
            Assert.AreEqual((uint)130, pSetup.verticalDpi);
        }
Пример #23
0
        public void TestSetSaveRead()
        {
            XSSFWorkbook wb = new XSSFWorkbook();
            XSSFSheet    s1 = (XSSFSheet)wb.CreateSheet();

            Assert.AreEqual(false, s1.GetCTWorksheet().IsSetPageSetup());
            Assert.AreEqual(true, s1.GetCTWorksheet().IsSetPageMargins());

            XSSFPrintSetup print = (XSSFPrintSetup)s1.PrintSetup;

            Assert.AreEqual(true, s1.GetCTWorksheet().IsSetPageSetup());
            Assert.AreEqual(true, s1.GetCTWorksheet().IsSetPageMargins());

            print.Copies    = ((short)3);
            print.Landscape = (true);
            Assert.AreEqual(3, print.Copies);
            Assert.AreEqual(true, print.Landscape);

            XSSFSheet s2 = (XSSFSheet)wb.CreateSheet();

            Assert.AreEqual(false, s2.GetCTWorksheet().IsSetPageSetup());
            Assert.AreEqual(true, s2.GetCTWorksheet().IsSetPageMargins());

            // Round trip and check
            XSSFWorkbook wbBack = (XSSFWorkbook)XSSFITestDataProvider.instance.WriteOutAndReadBack(wb);

            s1 = (XSSFSheet)wbBack.GetSheetAt(0);
            s2 = (XSSFSheet)wbBack.GetSheetAt(1);

            Assert.AreEqual(true, s1.GetCTWorksheet().IsSetPageSetup());
            Assert.AreEqual(true, s1.GetCTWorksheet().IsSetPageMargins());
            Assert.AreEqual(false, s2.GetCTWorksheet().IsSetPageSetup());
            Assert.AreEqual(true, s2.GetCTWorksheet().IsSetPageMargins());

            print = (XSSFPrintSetup)s1.PrintSetup;
            Assert.AreEqual(3, print.Copies);
            Assert.AreEqual(true, print.Landscape);

            wb.Close();
        }
Пример #24
0
        public void TestSetGetHVResolution()
        {
            CT_Worksheet worksheet = new CT_Worksheet();
            CT_PageSetup pSetup = worksheet.AddNewPageSetup();
            pSetup.horizontalDpi = (120);
            pSetup.verticalDpi = (100);
            XSSFPrintSetup printSetup = new XSSFPrintSetup(worksheet);
            Assert.AreEqual(120, printSetup.HResolution);
            Assert.AreEqual(100, printSetup.VResolution);

            printSetup.HResolution = ((short)150);
            printSetup.VResolution = ((short)130);
            Assert.AreEqual((uint)150, pSetup.horizontalDpi);
            Assert.AreEqual((uint)130, pSetup.verticalDpi);
        }
Пример #25
0
        public void TestSetGetLeftToRight()
        {
            CT_Worksheet worksheet = new CT_Worksheet();
            CT_PageSetup pSetup = worksheet.AddNewPageSetup();
            pSetup.pageOrder = (ST_PageOrder.downThenOver);
            XSSFPrintSetup printSetup = new XSSFPrintSetup(worksheet);
            Assert.AreEqual(false, printSetup.LeftToRight);

            printSetup.LeftToRight = (true);
            Assert.AreEqual(PageOrder.OVER_THEN_DOWN.Value, (int)pSetup.pageOrder);
        }
Пример #26
0
        public void TestSetGetOrientation()
        {
            CT_Worksheet worksheet = new CT_Worksheet();
            CT_PageSetup pSetup = worksheet.AddNewPageSetup();
            pSetup.orientation = (ST_Orientation.portrait);
            XSSFPrintSetup printSetup = new XSSFPrintSetup(worksheet);
            Assert.AreEqual(PrintOrientation.PORTRAIT, printSetup.Orientation);
            Assert.AreEqual(false, printSetup.Landscape);
            Assert.AreEqual(false, printSetup.NoOrientation);

            printSetup.Orientation = (PrintOrientation.LANDSCAPE);
            Assert.AreEqual((int)pSetup.orientation, printSetup.Orientation.Value);
            Assert.AreEqual(true, printSetup.Landscape);
            Assert.AreEqual(false, printSetup.NoOrientation);
        }
Пример #27
0
        public void TestSetGetValidSettings()
        {
            CT_Worksheet worksheet = new CT_Worksheet();
            CT_PageSetup pSetup = worksheet.AddNewPageSetup();
            pSetup.usePrinterDefaults = (false);
            XSSFPrintSetup printSetup = new XSSFPrintSetup(worksheet);
            Assert.AreEqual(false, printSetup.ValidSettings);

            printSetup.ValidSettings = (true);
            Assert.AreEqual(true, pSetup.usePrinterDefaults);
        }
Пример #28
0
        public void TestSetGetNoColor()
        {
            CT_Worksheet worksheet = new CT_Worksheet();
            CT_PageSetup pSetup = worksheet.AddNewPageSetup();
            pSetup.blackAndWhite = (false);
            XSSFPrintSetup printSetup = new XSSFPrintSetup(worksheet);
            Assert.AreEqual(false, printSetup.NoColor);

            printSetup.NoColor = true;
            Assert.AreEqual(true, pSetup.blackAndWhite);
        }
Пример #29
0
        public void TestSetGetNotes()
        {
            CT_Worksheet worksheet = new CT_Worksheet();
            CT_PageSetup pSetup = worksheet.AddNewPageSetup();
            pSetup.cellComments = ST_CellComments.none;
            XSSFPrintSetup printSetup = new XSSFPrintSetup(worksheet);
            Assert.AreEqual(false, printSetup.Notes);

            printSetup.Notes = true;
            Assert.AreEqual(PrintCellComments.AS_DISPLAYED.Value, (int)pSetup.cellComments);
        }
Пример #30
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);
        }
Пример #31
0
        public void TestSetGetUsePage()
        {
            CT_Worksheet worksheet = new CT_Worksheet();
            CT_PageSetup pSetup = worksheet.AddNewPageSetup();
            pSetup.useFirstPageNumber = (false);
            XSSFPrintSetup printSetup = new XSSFPrintSetup(worksheet);
            Assert.AreEqual(false, printSetup.UsePage);

            printSetup.UsePage = (true);
            Assert.AreEqual(true, pSetup.useFirstPageNumber);
        }