/// <summary> /// A function that should return the string to be printed on /// this call to Print() /// </summary> /// <param name="reportDocument">The parent ReportDocument</param> /// <returns>A string to be printed on this page</returns> protected override string GetText(ReportDocument reportDocument) { string text; int pageNumber = reportDocument.GetCurrentPage(); if (pageNumber == 1) { text = TextFirstPage; } else if (pageNumber % 2 == 0) { text = TextEvenPage; } else { text = TextOddPage; } if (text == null) { if (this.Text == null) { text = String.Empty; } else { text = this.Text; } } text = text.Replace("%p", pageNumber.ToString()); // TODO: Raise event for formatting text??? return(text); }
/// <summary> /// Called to calculate the size that this section requires on /// the next call to Print. This method will be called once /// prior to each call to Print. /// </summary> /// <param name="reportDocument">The parent ReportDocument that is printing.</param> /// <param name="g">Graphics object to print on.</param> /// <param name="bounds">Bounds of the area to print within. /// The bounds passed already takes the margins into account - so you cannot /// print or do anything within these margins. /// </param> /// <returns>The values for RequireSize, Fits and Continues for this section.</returns> protected override SectionSizeValues DoCalcSize( ReportDocument reportDocument, Graphics g, Bounds bounds ) { SectionSizeValues retval = new SectionSizeValues(); retval.Fits = true; int page = reportDocument.GetCurrentPage(); if (this.firstTimeCalled) { this.pageNumber = page; retval.Continued = this.pageBreak; retval.RequiredSize = bounds.GetSizeF(); this.firstTimeCalled = false; if (this.setOrientation) { reportDocument.SetPageOrientation(page + 1, this.newPageOrientation); } } else { if (this.pageBreak && (page == this.pageNumber)) { retval.Continued = true; retval.RequiredSize = bounds.GetSizeF(); } else { retval.Continued = false; retval.RequiredSize = new SizeF(0, 0); } } return(retval); }
/// <summary> /// A function that should return the string to be printed on /// this call to Print() /// </summary> /// <param name="reportDocument">The parent ReportDocument</param> /// <returns>A string to be printed on this page</returns> protected override string GetText(ReportDocument reportDocument) { string text; int pageNumber = reportDocument.GetCurrentPage(); if (pageNumber == 1) { text = TextFirstPage; } else if (pageNumber % 2 == 0) { text = TextEvenPage; } else { text = TextOddPage; } if (text == null) { if (this.Text == null) { text = String.Empty; } else { text = this.Text; } } text = text.Replace("%p", pageNumber.ToString()); text = text.Replace("%tp", reportDocument.TotalPages.ToString()); // TODO: Raise event for formatting text??? return text; }
/// <summary> /// Called to calculate the size that this section requires on /// the next call to Print. This method will be called once /// prior to each call to Print. /// </summary> /// <param name="reportDocument">The parent ReportDocument that is printing.</param> /// <param name="g">Graphics object to print on.</param> /// <param name="bounds">Bounds of the area to print within. /// The bounds passed already takes the margins into account - so you cannot /// print or do anything within these margins. /// </param> /// <returns>The values for RequireSize, Fits and Continues for this section.</returns> protected override SectionSizeValues DoCalcSize( ReportDocument reportDocument, Graphics g, Bounds bounds ) { SectionSizeValues retval = new SectionSizeValues(); retval.Fits = true; int page = reportDocument.GetCurrentPage(); if (this.firstTimeCalled) { this.pageNumber = page; retval.Continued = this.pageBreak; retval.RequiredSize = bounds.GetSizeF(); this.firstTimeCalled = false; if (this.setOrientation) { reportDocument.SetPageOrientation (page + 1, this.newPageOrientation); } } else { if (this.pageBreak && (page == this.pageNumber)) { retval.Continued = true; retval.RequiredSize = bounds.GetSizeF(); } else { retval.Continued = false; retval.RequiredSize = new SizeF (0, 0); } } return retval; }