示例#1
0
        private bool DoAdd(Base c, XmlItem item)
        {
            if (c == null)
            {
                return(false);
            }
            ReportEngine engine    = Report.Engine;
            bool         isRunning = Report.IsRunning && engine != null;

            if (c is ReportComponentBase)
            {
                if (isRunning && !engine.CanPrint(c as ReportComponentBase))
                {
                    return(false);
                }
            }

            item = item.Add();
            using (FRWriter writer = new FRWriter(item))
            {
                writer.SerializeTo  = SerializeTo.Preview;
                writer.SaveChildren = false;
                writer.BlobStore    = preparedPages.BlobStore;
                writer.Write(c);
            }
            if (isRunning)
            {
                engine.AddObjectToProcess(c, item);
            }

            if ((c.Flags & Flags.CanWriteChildren) == 0)
            {
                ObjectCollection childObjects = c.ChildObjects;
                foreach (Base obj in childObjects)
                {
                    DoAdd(obj, item);
                }
            }

            return(true);
        }