Esempio n. 1
0
		private void ShowPreviewWithDialog (AbstractRenderer renderer,double zoomFaktor) {
			
			System.Drawing.Printing.PrintDocument  doc = renderer.ReportDocument;
			
			printPreviewControl1.InvalidatePreview();
			previewDlg.Document = doc;
			previewDlg.Text	= renderer.ReportSettings.ReportName;
			previewDlg.Text = renderer.ReportSettings.ReportName;
			previewDlg.StartPosition = FormStartPosition.CenterParent;
			previewDlg.PrintPreviewControl.Zoom = zoomFaktor;
			previewDlg.ShowDialog();
		}
Esempio n. 2
0
		public void ShowPreview (AbstractRenderer renderer,double zoomFaktor,bool standAlone) {
			if (renderer == null) {
				throw new ArgumentNullException("renderer");
			}
			
			if (renderer.Cancel == false) {
				if (standAlone) {
					this.ShowPreviewWithUserControl (renderer,zoomFaktor);
				}
				else {
					ShowPreviewWithDialog(renderer,zoomFaktor);
				}
			}
		}
Esempio n. 3
0
		private void ShowPreviewWithUserControl (AbstractRenderer renderer,double zoomFaktor) {
			
			System.Drawing.Printing.PrintDocument  doc = renderer.ReportDocument;
			//doc.PrintController = new ExtendedPrintController(new System.Drawing.Printing.PreviewPrintController());
			
//			doc.Print();
			
			printPreviewControl1.InvalidatePreview();
			printPreviewControl1.Document = null;
			printPreviewControl1.Document = doc;

			printPreviewControl1.Zoom = zoomFaktor;
			printPreviewControl1.Document.DocumentName = renderer.ReportSettings.ReportName;
			printPreviewControl1.UseAntiAlias = true;
		}
Esempio n. 4
0
		private static void ReportToPrinter (AbstractRenderer renderer,IReportModel model) {
			if (renderer == null) {
				throw new ArgumentNullException("renderer");
			}
			if (model == null) {
				throw new ArgumentNullException("model");
			}
			PrintDocument  doc = null;
			if (renderer.Cancel == false) {
				doc = renderer.ReportDocument;
				using (PrintDialog dlg = new PrintDialog()) {
					dlg.Document = doc;
					if (model.ReportSettings.UseStandardPrinter == true) {
						dlg.Document.Print();
					} else {
						DialogResult result = dlg.ShowDialog();
						// If the result is OK then print the document.
						if (result==DialogResult.OK){
							dlg.Document.Print();
						}
					}
				}
			}
		}
 private void PerformPageBreak(ReportPageEventArgs rpea)
 {
     AbstractRenderer.PageBreak(rpea);
     this.RemoveSectionEvents();
 }
        private void PrintDetailInternal(ReportPageEventArgs rpea, DataNavigator nav)
        {
            Rectangle sectionRect;

            base.PrintDetail(null, rpea);

            // no loop if there is no data
            if (!nav.HasMoreData)
            {
                rpea.PrintPageEventArgs.HasMorePages = false;
                return;
            }

            ITableContainer tableContainer = base.CurrentSection.Items[0] as ITableContainer;

            // branch to render table's etc
            if (tableContainer != null)
            {
                tableContainer.DataNavigator = nav;
                tableContainer.Parent        = base.CurrentSection;
                if (rpea.SinglePage.PageNumber == 1)
                {
                    tableContainer.StartLayoutAt(base.Sections[2]);
                }
                else
                {
                    tableContainer.StartLayoutAt(base.Sections[0]);
                }


                base.RenderTable(base.CurrentSection, tableContainer, rpea);

                this.ReportDocument.DetailsDone = true;
            }

            else
            {
                // first element
                if (base.SinglePage.PageNumber == 1)
                {
                    this.dataNavigator.MoveNext();
                }

                do
                {
                    ISimpleContainer simpleContainer = base.CurrentSection.Items[0] as ISimpleContainer;

                    if (simpleContainer != null)
                    {
                        nav.Fill(simpleContainer.Items);
                    }
                    else
                    {
                        nav.Fill(base.CurrentSection.Items);
                    }

                    sectionRect = new Rectangle(rpea.PrintPageEventArgs.MarginBounds.Left,
                                                base.CurrentSection.SectionOffset,
                                                rpea.PrintPageEventArgs.MarginBounds.Width,
                                                base.CurrentSection.Size.Height);


                    if (PrintHelper.IsPageFull(sectionRect, base.SectionBounds))
                    {
                        PerformPageBreak(rpea);
                        return;
                    }

                    Point currentPosition = base.RenderItems(rpea);


                    if (nav.CurrentRow < nav.Count - 1)
                    {
                        if (base.CurrentSection.PageBreakAfter)
                        {
                            PerformPageBreak(rpea);
                            return;
                        }
                    }

                    base.CurrentSection.SectionOffset = currentPosition.Y;

                    rpea.LocationAfterDraw = new Point(rpea.LocationAfterDraw.X,
                                                       currentPosition.Y);
                }while (nav.MoveNext());
                this.ReportDocument.DetailsDone = true;
            }

            rpea.LocationAfterDraw = new Point(rpea.LocationAfterDraw.X, rpea.LocationAfterDraw.Y + 5);
            if (!PrintHelper.IsRoomForFooter(base.SectionBounds, rpea.LocationAfterDraw))
            {
                AbstractRenderer.PageBreak(rpea);
            }
        }