using FastReport.Utils; using System; namespace FastReport.Engine { public partial class ReportEngine { #region Properties /// /// Gets xml containing outline nodes. /// public XmlItem OutlineXml { get { return PreparedPages.Outline.Xml; } } #endregion Properties #region Private Methods private void AddOutline(string name, int pageNo, float curY) { PreparedPages.Outline.Add(name, pageNo, curY); } private void AddBandOutline(BandBase band) { if (band.Visible && !String.IsNullOrEmpty(band.OutlineExpression) && !band.Repeated) { AddOutline(Converter.ToString(Report.Calc(band.OutlineExpression)), CurPage, CurY); if (!(band is DataBand) && !(band is GroupHeaderBand)) OutlineUp(); } } private void AddPageOutline() { if (!String.IsNullOrEmpty(page.OutlineExpression)) AddOutline(Converter.ToString(Report.Calc(page.OutlineExpression)), CurPage, 0); } private void OutlineUp(BandBase band) { if (band is DataBand || band is GroupHeaderBand) { if (!String.IsNullOrEmpty(band.OutlineExpression)) OutlineUp(); } } #endregion Private Methods #region Public Methods /// /// Creates a new outline element with specified text. /// /// Text of element. /// /// After you call this method, the element will be added to the current position in the outline. /// The next call to AddOutline will add new element as a child of this element. /// To shift the position, use the or /// OutlineUp methods. /// public void AddOutline(string text) { AddOutline(text, CurPage, CurY); } /// /// Sets the current outline position to root. /// public void OutlineRoot() { PreparedPages.Outline.LevelRoot(); } /// /// Shifts the current outline position one level up. /// public void OutlineUp() { PreparedPages.Outline.LevelUp(); } /// /// Creates a new bookmark with specified name at current position. /// /// public void AddBookmark(string name) { if (!String.IsNullOrEmpty(name)) PreparedPages.Bookmarks.Add(name, CurPage, CurY); } /// /// Gets a page number for the specified bookmark name. /// /// Name of bookmark. /// Page number if bookmark with such name found; 0 otherwise. /// /// Use this method to print the table of contents in your report. Normally it can be done /// using bookmarks. /// /// You must set your report to double pass to use this method. /// /// public int GetBookmarkPage(string name) { return PreparedPages.Bookmarks.GetPageNo(name); } #endregion Public Methods } }