Ejemplo n.º 1
0
        private static void ProcessReportObjects(ReportObject ro, XmlWriter xmlw)
        {
            xmlw.WriteStartElement(ro.Kind.ToStringSafe());
            // for all types the same properties
            xmlw.WriteAttributeString("Height", ro.Height.ToStringSafe());
            xmlw.WriteAttributeString("Kind", ro.Kind.ToStringSafe());
            xmlw.WriteAttributeString("Left", ro.Left.ToStringSafe());
            xmlw.WriteAttributeString("Name", ro.Name);
            xmlw.WriteAttributeString("Top", ro.Top.ToStringSafe());
            xmlw.WriteAttributeString("Width", ro.Width.ToStringSafe());
            // kind specific properties
            switch (ro.Kind)
            {
            case ReportObjectKind.BlobFieldObject:
            {
                BlobFieldObject bfo = (BlobFieldObject)ro;
                ProcessDatabaseFieldDefinition(bfo.DataSource, xmlw);
                bfo.Dispose();
                break;
            }

            case ReportObjectKind.BoxObject:
            {
                BoxObject bo = (BoxObject)ro;
                xmlw.WriteAttributeString("Bottom", bo.Bottom.ToStringSafe());
                xmlw.WriteAttributeString("EnableExtendToBottomOfSection", bo.EnableExtendToBottomOfSection.ToStringSafe());
                xmlw.WriteAttributeString("EndSectionName", bo.EndSectionName);
                xmlw.WriteAttributeString("FillColor", bo.FillColor.ToStringSafe());
                xmlw.WriteAttributeString("LineColor", bo.LineColor.ToStringSafe());
                xmlw.WriteAttributeString("LineStyle", bo.LineStyle.ToStringSafe());
                xmlw.WriteAttributeString("LineThickness", bo.LineThickness.ToStringSafe());
                xmlw.WriteAttributeString("Right", bo.Right.ToStringSafe());
                bo.Dispose();
                break;
            }

            case ReportObjectKind.FieldHeadingObject:
            {
                FieldHeadingObject fho = (FieldHeadingObject)ro;
                xmlw.WriteAttributeString("Color", fho.Color.ToStringSafe());
                xmlw.WriteAttributeString("Font", fho.Font.ToStringSafe());
                xmlw.WriteAttributeString("Text", fho.Text);
                xmlw.WriteAttributeString("FieldObjectName", fho.FieldObjectName);
                fho.Dispose();
                break;
            }

            case ReportObjectKind.FieldObject:
            {
                FieldObject fo = (FieldObject)ro;
                xmlw.WriteAttributeString("Color", fo.Color.ToStringSafe());
                xmlw.WriteAttributeString("Font", fo.Font.ToStringSafe());
                if (fo.DataSource != null)
                {
                    ProcessFieldDefinition(fo.DataSource, xmlw, "DataSource");
                }
                ProcessFieldFormat(fo.FieldFormat, xmlw);
                fo.Dispose();
                break;
            }

            case ReportObjectKind.LineObject:
            {
                LineObject lo = (LineObject)ro;
                xmlw.WriteAttributeString("Bottom", lo.Bottom.ToStringSafe());
                xmlw.WriteAttributeString("EnableExtendToBottomOfSection", lo.EnableExtendToBottomOfSection.ToStringSafe());
                xmlw.WriteAttributeString("EndSectionName", lo.EndSectionName);
                xmlw.WriteAttributeString("LineColor", lo.LineColor.ToStringSafe());
                xmlw.WriteAttributeString("LineStyle", lo.LineStyle.ToStringSafe());
                xmlw.WriteAttributeString("LineThickness", lo.LineThickness.ToStringSafe());
                xmlw.WriteAttributeString("Right", lo.Right.ToStringSafe());
                lo.Dispose();
                break;
            }

            case ReportObjectKind.SubreportObject:
            {
                SubreportObject so = (SubreportObject)ro;
                xmlw.WriteAttributeString("EnableOnDemand", so.EnableOnDemand.ToStringSafe());
                xmlw.WriteAttributeString("SubreportName", so.SubreportName);
                ro.Dispose();
                break;
            }

            case ReportObjectKind.TextObject:
            {
                TextObject to = (TextObject)ro;
                xmlw.WriteAttributeString("Color", to.Color.ToStringSafe());
                xmlw.WriteAttributeString("Font", to.Font.ToStringSafe());
                xmlw.WriteAttributeString("Text", to.Text);
                to.Dispose();
                break;
            }

            default:
            {
                break;
            }
            }
            ProcessBorder(ro.Border, xmlw);
            ProcessObjectFormat(ro.ObjectFormat, xmlw);
            xmlw.WriteEndElement();
        }