public void PostprocessUnlimited(PreparedPage preparedPage, ReportPage page) { bool flag = false; int i = 0; foreach (Base b in preparedPage.GetPageItems(page, true)) { foreach (Base c in b.AllObjects) { if (c is TextObjectBase && (c as TextObjectBase).Duplicates != Duplicates.Show) { ProcessDuplicates(c as TextObjectBase); flag = true;//flag for keep in dictionary } } i++; if (flag) { b.ExtractMacros(); bands[i - 1] = b; } else { b.Dispose(); } } CloseDuplicates(); }
internal void InterleaveWithBackPage(int backPageIndex) { PreparedPage page = preparedPages[backPageIndex]; int count = backPageIndex - 1; for (int i = 0; i < count; i++) { preparedPages.Insert(i * 2 + 1, page); } }
/// <summary> /// Loads prepared pages from a stream. /// </summary> /// <param name="stream">The stream to load from.</param> public void Load(Stream stream) { Clear(); bool compressed = Compressor.IsStreamCompressed(stream); if (compressed) { stream = Compressor.Decompress(stream, false); } try { using (XmlDocument doc = new XmlDocument()) { doc.Load(stream); XmlItem sourcePages = doc.Root.FindItem("sourcepages"); SourcePages.Load(sourcePages); XmlItem dictionary = doc.Root.FindItem("dictionary"); Dictionary.Load(dictionary); XmlItem bookmarks = doc.Root.FindItem("bookmarks"); Bookmarks.Load(bookmarks); XmlItem outline = doc.Root.FindItem("outline"); Outline.Xml = outline; XmlItem blobStore = doc.Root.FindItem("blobstore"); BlobStore.Load(blobStore); XmlItem pages = doc.Root.FindItem("pages"); while (pages.Count > 0) { XmlItem pageItem = pages[0]; PreparedPage preparedPage = new PreparedPage(null, this); FPreparedPages.Add(preparedPage); preparedPage.Xml = pageItem; } } } finally { if (compressed) { stream.Dispose(); } } }
/// <summary> /// Replaces the prepared page with specified one. /// </summary> /// <param name="index">The index of prepared page to replace.</param> /// <param name="newPage">The new page to replace with.</param> public void ModifyPage(int index, ReportPage newPage) { PreparedPage preparedPage = new PreparedPage(newPage, this); foreach (Base obj in newPage.ChildObjects) { if (obj is BandBase) { preparedPage.AddBand(obj as BandBase); } } preparedPages[index].Dispose(); preparedPages[index] = preparedPage; pageCache.Remove(index); }
/// <summary> /// Creates a copy of a page with specified index and inserts it after original one. /// </summary> /// <param name="index">The zero-based index of original page.</param> public void CopyPage(int index) { // insert a new empty page at specified index PreparedPage newPage = new PreparedPage(null, this); if (index == preparedPages.Count - 1) { preparedPages.Add(newPage); } else { preparedPages.Insert(index + 1, newPage); } // and copy source page into it ModifyPage(index + 1, GetPage(index)); pageCache.Clear(); }
/// <summary> /// Adds a new page. /// </summary> /// <param name="page">The original (template) page to add.</param> /// <remarks> /// Call the <see cref="AddSourcePage"/> method before adding a page. This method creates /// a new output page with settings based on <b>page</b> parameter. /// </remarks> public void AddPage(ReportPage page) { CurPage++; if (CurPage >= Count || AddPageAction != AddPageAction.WriteOver) { PreparedPage preparedPage = new PreparedPage(page, this); preparedPages.Add(preparedPage); // upload previous page to the file cache if enabled if (CanUploadToCache && Count > 1) { preparedPages[Count - 2].Upload(); } AddPageAction = AddPageAction.WriteOver; CurPage = Count - 1; Report.Engine.IncLogicalPageNumber(); } }
/// <summary> /// Loads prepared pages from a stream. /// </summary> /// <param name="stream">The stream to load from.</param> public void Load(Stream stream) { Clear(); if (!stream.CanSeek) { MemoryStream tempStream = new MemoryStream(); FileUtils.CopyStream(stream, tempStream); tempStream.Position = 0; stream = tempStream; } if (stream.Length == 0) { return; } bool compressed = Compressor.IsStreamCompressed(stream); if (compressed) { stream = Compressor.Decompress(stream, false); } try { using (XmlDocument doc = new XmlDocument()) { doc.Load(stream); XmlItem sourcePages = doc.Root.FindItem("sourcepages"); SourcePages.Load(sourcePages); XmlItem dictionary = doc.Root.FindItem("dictionary"); Dictionary.Load(dictionary); XmlItem bookmarks = doc.Root.FindItem("bookmarks"); Bookmarks.Load(bookmarks); XmlItem outline = doc.Root.FindItem("outline"); Outline.Xml = outline; XmlItem blobStore = doc.Root.FindItem("blobstore"); BlobStore.LoadDestructive(blobStore); XmlItem pages = doc.Root.FindItem("pages"); while (pages.Count > 0) { XmlItem pageItem = pages[0]; PreparedPage preparedPage = new PreparedPage(null, this); preparedPages.Add(preparedPage); preparedPage.Xml = pageItem; } // load ReportInfo Report.ReportInfo.Name = doc.Root.GetProp("ReportInfo.Name"); Report.ReportInfo.Author = doc.Root.GetProp("ReportInfo.Author"); Report.ReportInfo.Description = doc.Root.GetProp("ReportInfo.Description"); DateTime createDate; if (DateTime.TryParse(doc.Root.GetProp("ReportInfo.Created"), out createDate)) { Report.ReportInfo.Created = createDate; } if (DateTime.TryParse(doc.Root.GetProp("ReportInfo.Modified"), out createDate)) { Report.ReportInfo.Modified = createDate; } Report.ReportInfo.CreatorVersion = doc.Root.GetProp("ReportInfo.CreatorVersion"); } } finally { if (compressed) { stream.Dispose(); } } }