Ejemplo n.º 1
0
        public C1.C1Preview.C1PrintDocument MakeDoc(C1FlexGridPrintInfo printInfo, C1.C1Preview.LongOperationEventHandler longOperation)
        {
            _callerLongOperation = longOperation;
            C1.C1Preview.C1PrintDocument doc = new C1.C1Preview.C1PrintDocument();
            // there are many ways to skin a cat, or to render the four splits.
            // here, we use a master table with two rows and two columns,
            // rendering each grid in its own cell:
            C1.C1Preview.RenderTable table = new C1.C1Preview.RenderTable();
            C1FlexGridPrinter        prnTL = new C1FlexGridPrinter(_flexTL);

            prnTL.PrintInfo      = printInfo;
            prnTL.LongOperation += new C1.C1Preview.LongOperationEventHandler(print_LongOperation);
            C1FlexGridPrinter prnTR = new C1FlexGridPrinter(_flexTR);

            prnTR.PrintInfo      = printInfo;
            prnTR.LongOperation += new C1.C1Preview.LongOperationEventHandler(print_LongOperation);
            C1FlexGridPrinter prnBL = new C1FlexGridPrinter(_flexBL);

            prnBL.PrintInfo      = printInfo;
            prnBL.LongOperation += new C1.C1Preview.LongOperationEventHandler(print_LongOperation);
            C1FlexGridPrinter prnBR = new C1FlexGridPrinter(_flexBR);

            prnBR.PrintInfo                = printInfo;
            prnBR.LongOperation           += new C1.C1Preview.LongOperationEventHandler(print_LongOperation);
            _currPrintedGrid               = 0;
            table.Cells[0, 0].RenderObject = prnTL.MakeGridTable(doc);
            _currPrintedGrid               = 1;
            table.Cells[0, 1].RenderObject = prnTR.MakeGridTable(doc);
            _currPrintedGrid               = 2;
            table.Cells[1, 0].RenderObject = prnBL.MakeGridTable(doc);
            _currPrintedGrid               = 3;
            table.Cells[1, 1].RenderObject = prnBR.MakeGridTable(doc);
            // by default, a table's width is set to 100% of its parent (here, page).
            // so we set it to auto, and enable horizontal page breaks:
            table.Width             = "auto";
            table.SplitHorzBehavior = C1.C1Preview.SplitBehaviorEnum.SplitIfNeeded;
            // by default, table rows and columns do not split; enable it here:
            table.Rows[0].SplitBehavior = C1.C1Preview.SplitBehaviorEnum.SplitIfNeeded;
            table.Rows[1].SplitBehavior = C1.C1Preview.SplitBehaviorEnum.SplitIfNeeded;
            table.Cols[0].SplitBehavior = C1.C1Preview.SplitBehaviorEnum.SplitIfNeeded;
            table.Cols[1].SplitBehavior = C1.C1Preview.SplitBehaviorEnum.SplitIfNeeded;
            // add thick blue gridlines between the splits:
            table.Style.GridLines.All = new C1.C1Preview.LineDef("2pt", Color.Blue);
            // the table with four splits is ready - add it to the documment:
            doc.Body.Children.Add(table);
            // use page headers from the top left grid:
            doc.PageLayout.PageHeader = prnTL.MakePageHeader(doc);
            doc.PageLayout.PageFooter = prnTL.MakePageFooter(doc);
            // done:
            return(doc);
        }
Ejemplo n.º 2
0
        public C1.C1Preview.C1PrintDocument MakeDoc(C1FlexGridPrintInfo printInfo, C1.C1Preview.LongOperationEventHandler longOperation)
        {
            // select the grid to print:
            C1FlexGrid flex = C1FlexGridPrinterTest.SampleWrapper.FindGrid(this.tabControl1.SelectedTab);

            if (flex == null)
            {
                return(null);
            }
            C1.C1Preview.C1PrintDocument doc     = new C1.C1Preview.C1PrintDocument();
            C1FlexGridPrinter            printer = new C1FlexGridPrinter(flex);

            printer.LongOperation    += longOperation;
            printer.PrintInfo         = printInfo;
            doc.PageLayout.PageHeader = printer.MakePageHeader(doc);
            doc.PageLayout.PageFooter = printer.MakePageFooter(doc);
            doc.Body.Children.Add(printer.MakeGridTable(doc));
            return(doc);
        }