Esempio n. 1
0
        protected AojPrintTable(AojPrintTable obj)
            : base(obj)
        {
            Cells = new List<Cell>();
            Columns = new List<Column>();
            Rows = new List<Row>();

            foreach (Cell o in obj.Cells)
            {
                this.Cells.Add((Cell)o.Clone());
            }
            foreach (Row r in obj.Rows)
            {
                this.Rows.Add((Row)r.Clone());
            }
            foreach (Column col in obj.Columns)
            {
                this.Columns.Add((Column)col.Clone());
            }
        }
Esempio n. 2
0
        public bool Parse(AojPrintXmlReader aojXmlReader)
        {
            //Paper节点访问后得到的属性
            Hashtable hstPaper = aojXmlReader.Attributes;
            //如果本paper没有Id则默认为Group
            this._id = AojUnitConvert.SafeToString(hstPaper, "Id", "PaperGroup");
            this._width = AojUnitConvert.SafeToInt(hstPaper, "Width", 596);
            this._height = AojUnitConvert.SafeToInt(hstPaper, "Height", 840);
            this._paperSizeName = AojUnitConvert.SafeToString(hstPaper, "PaperSizeName", "A4");
            this._orientation = AojUnitConvert.SafeToString(hstPaper, "Orientation", "Portrait");
            this._margin = AojUnitConvert.SafeToInt(hstPaper, "Margin", 1);

            while (aojXmlReader.Read())
            {
                //当读取器读到结束节点为AojPaper时,说明一张页面已经读取完毕
                //然后由AojPrint类,继续读取进行下一轮的Paper创建
                if (aojXmlReader.IsEndElement("AojPaper"))
                {
                    break;
                }
                switch (aojXmlReader.TagName)
                {
                    case "Label":
                        {
                            //读到Label节点时,进行Label节点属性的读取
                            AojPrintLabel printLabel = new AojPrintLabel();
                            printLabel.Parse(aojXmlReader);
                            this._objectArray.Add(printLabel);
                        }
                        break;
                    case "Image":
                        {
                            //读到Image节点时,进行Image节点属性的读取
                            AojPrintImage printImage = new AojPrintImage();
                            printImage.Parse(aojXmlReader);
                            this._objectArray.Add(printImage);
                        }
                        break;
                    case "Table":
                        {
                            //读到Table节点时,进行Table节点属性的读取
                            AojPrintTable printTable = new AojPrintTable();
                            printTable.Parse(aojXmlReader);
                            this._objectArray.Add(printTable);
                        }
                        break;
                    default:  //查找自定义插件中的对象
                        {
                            AojPrintSettings settings= AojPrintSettings.CreateInstance();
                            KeyValuePair<string,object> CurrentPlugin =settings.lstPlugin.Find((plk) => plk.Key == aojXmlReader.TagName);
                            if (CurrentPlugin.Value is IAojPrintObjectParse)
                            {
                                IAojPrintObjectParse aojPluginObject= (IAojPrintObjectParse)CurrentPlugin.Value;
                                //用此类库Parse完后保存在对象集合中
                                aojPluginObject.Parse(aojXmlReader);
                                this._objectArray.Add(aojPluginObject);
                                //因为该类对象的所有操作后,属性系统都为引用,因此要Clone一下
                                this._objectArray = (ArrayList)this._objectArray.Clone();
                            }
                        }
                        break;
                }
            }
            return true;
        }
Esempio n. 3
0
 object ICloneable.Clone()
 {
     AojPrintTable aojPrintTable = new AojPrintTable(this);
     return aojPrintTable;
 }