/// <summary> /// Loads the collection from a stream. /// </summary> /// <param name="stream">Stream to load from.</param> public void Load(Stream stream) { using (FRReader reader = new FRReader(null)) { reader.Load(stream); reader.Read(this); } }
/// <summary> /// Loads the dictionary from a stream. /// </summary> /// <param name="stream">The stream to load from.</param> public void Load(Stream stream) { Clear(); using (FRReader reader = new FRReader(Report)) { reader.Load(stream); reader.Read(this); } }
private void LoadReport(Stream stream) { Report.Clear(); using (FRReader reader = new FRReader(Report)) { stream.Position = 0; reader.BlobStore = BlobStore; reader.Load(stream); reader.Read(Report); } }
public void Paste() { if (!CanPaste) { return; } using (ClipboardParent parent = new ClipboardParent()) using (MemoryStream stream = Clipboard.GetData("FastReport") as MemoryStream) using (FRReader reader = new FRReader(null)) { reader.Load(stream); reader.Read(parent); PageBase page = FDesigner.ActiveReportTab.ActivePage; if (page.GetType() == parent.PageType) { // prepare to create unique name ObjectCollection allObjects = page.Report.AllNamedObjects; // prepare a list of existing names Hashtable names = new Hashtable(); foreach (Base c in allObjects) { names[c.Name] = 0; } // since we are trying to preserve pasted object's name, add all names to the // allObjects list to guarantee that FastNameCreator will work correctly foreach (Base c in parent.AllObjects) { allObjects.Add(c); // there is an existing object with the same name. Clear the name to indicate // that we should create an unique name for this object if (names.ContainsKey(c.Name)) { c.Name = ""; } } FastNameCreator nameCreator = new FastNameCreator(allObjects); FDesigner.SelectedObjects.Clear(); foreach (Base c in parent.Objects) { c.Parent = FDesigner.ActiveReportTab.ActivePageDesigner.GetParentForPastedObjects(); if (c.Name == "") { nameCreator.CreateUniqueName(c); } // reset group index if (c is ComponentBase) { (c as ComponentBase).GroupIndex = 0; } FDesigner.Objects.Add(c); if (c is IParent) { foreach (Base c1 in c.AllObjects) { if (c1.Name == "") { nameCreator.CreateUniqueName(c1); } FDesigner.Objects.Add(c1); } } FDesigner.SelectedObjects.Add(c); } FDesigner.ActiveReportTab.ActivePageDesigner.Paste(parent.Objects, InsertFrom.Clipboard); } } }