Exemple #1
0
        public ZYTextDiv()
        {
            para        = new ZYTextParagraph();
            para.Parent = this;
            myChildElements.Add(para);

            #region mfb 测试单元格
            //TPTextTable table = new TPTextTable();
            //table.Parent = this;
            //table.Width = 2000;
            //table.Height = 500;


            //TPTextRow rows = new TPTextRow();
            //rows.Parent = table;

            //rows[0] = new TPTextCell();
            //rows[0].Parent = rows;
            //rows[1] = rows[0];
            //rows[2] = rows[0];
            //rows[3] = rows[0];


            //table[0] = rows;
            //table[1] = rows;
            //table[2] = rows;
            //table[3] = rows;
            //table[4] = rows;

            //myChildElements.Add(table);

            #endregion
        }
Exemple #2
0
        public TPTextCell()
        {
            //初始化边框
            this.BorderWidth = 1;
            this.BorderStyle = System.Windows.Forms.ButtonBorderStyle.Solid;
            this.BorderColor = Color.Black;

            para        = new ZYTextParagraph();
            para.Parent = this;
            myChildElements.Add(para);
        }
Exemple #3
0
        public TPTextCell(TPTextCell cell)
        {
            this.colspan             = cell.Colspan;
            this.rowspan             = cell.Rowspan;
            this.horizontalAlignment = cell.HorizontalAlignment;
            this.verticalAlignment   = cell.VerticalAlignment;

            this.bolSelected = cell.Selected;

            this.Width  = cell.Width;
            this.Height = cell.Height;

            this.backgroundColor = cell.backgroundColor;

            this.PaddingTop    = cell.PaddingTop;
            this.PaddingRight  = cell.PaddingRight;
            this.PaddingBottom = cell.PaddingBottom;
            this.PaddingLeft   = cell.PaddingLeft;

            this.BorderWidth       = cell.BorderWidth;
            this.BorderWidthTop    = cell.BorderWidthTop;
            this.BorderWidthRight  = cell.BorderWidthRight;
            this.BorderWidthBottom = cell.BorderWidthBottom;
            this.BorderWidthLeft   = cell.BorderWidthLeft;

            this.BorderColor       = cell.BorderColor;
            this.BorderColorTop    = cell.BorderColorTop;
            this.BorderColorRight  = cell.BorderColorRight;
            this.BorderColorBottom = cell.BorderColorBottom;
            this.BorderColorLeft   = cell.BorderColorLeft;

            this.BorderStyle       = cell.BorderStyle;
            this.BorderStyleTop    = cell.BorderStyleTop;
            this.BorderStyleRight  = cell.BorderStyleRight;
            this.BorderStyleBottom = cell.BorderStyleBottom;
            this.BorderStyleLeft   = cell.BorderStyleLeft;

            this.ItalicLineStyleInCell = cell.ItalicLineStyleInCell;//Add by wwj 2012-05-29

            this.para   = new ZYTextParagraph();
            para.Parent = this;
            myChildElements.Add(para);
        }
Exemple #4
0
 public PropertyParagraph(object o)
 {
     _p = (ZYTextParagraph)o;
 }
Exemple #5
0
        /// <summary>
        /// 单元格深度复制 Add by wwj 2012-05-30
        /// </summary>
        /// <returns></returns>
        public TPTextCell Clone()
        {
            TPTextCell newCell = new TPTextCell();

            newCell.myOwnerDocument = this.myOwnerDocument;

            newCell.myChildElements.Clear();

            newCell.colspan             = Colspan;
            newCell.rowspan             = Rowspan;
            newCell.horizontalAlignment = HorizontalAlignment;
            newCell.verticalAlignment   = VerticalAlignment;

            newCell.bolSelected = Selected;

            newCell.Width  = Width;
            newCell.Height = Height;

            newCell.backgroundColor = backgroundColor;

            newCell.PaddingTop    = PaddingTop;
            newCell.PaddingRight  = PaddingRight;
            newCell.PaddingBottom = PaddingBottom;
            newCell.PaddingLeft   = PaddingLeft;

            newCell.BorderWidth       = BorderWidth;
            newCell.BorderWidthTop    = BorderWidthTop;
            newCell.BorderWidthRight  = BorderWidthRight;
            newCell.BorderWidthBottom = BorderWidthBottom;
            newCell.BorderWidthLeft   = BorderWidthLeft;

            newCell.BorderColor       = BorderColor;
            newCell.BorderColorTop    = BorderColorTop;
            newCell.BorderColorRight  = BorderColorRight;
            newCell.BorderColorBottom = BorderColorBottom;
            newCell.BorderColorLeft   = BorderColorLeft;

            newCell.BorderStyle       = BorderStyle;
            newCell.BorderStyleTop    = BorderStyleTop;
            newCell.BorderStyleRight  = BorderStyleRight;
            newCell.BorderStyleBottom = BorderStyleBottom;
            newCell.BorderStyleLeft   = BorderStyleLeft;

            newCell.ContentHeight = ContentHeight;

            newCell.ItalicLineStyleInCell = ItalicLineStyleInCell;//Add by wwj 2012-05-29

            //***************************************
            newCell.ChildElements.Clear();

            for (int i = 0; i < myChildElements.Count; i++)//遍历单元格中的段落
            {
                ZYTextParagraph para = myChildElements[i] as ZYTextParagraph;
                if (para != null)
                {
                    ZYTextParagraph newPara = new ZYTextParagraph();
                    newPara.Parent        = newCell;
                    newPara.OwnerDocument = newCell.OwnerDocument;
                    newCell.myChildElements.Add(newPara);
                    StringBuilder sb = new StringBuilder();
                    para.GetFinalText(sb);
                    newPara.Align = para.Align;

                    foreach (ZYTextElement myElement in para.ChildElements) //遍历段落中的没有元素
                    {
                        if (myElement is ZYTextChar)                        //如果文本元素
                        {
                            ZYTextChar oldChar = myElement as ZYTextChar;
                            ZYTextChar NewChar = ZYTextChar.Create(oldChar.Char);
                            NewChar.OwnerDocument = newCell.OwnerDocument;
                            NewChar.Parent        = newPara;
                            newPara.InsertBefore(NewChar, newPara.LastElement);
                            NewChar.FontName = oldChar.FontName;
                            NewChar.FontSize = oldChar.FontSize;
                            NewChar.Height   = oldChar.Height;
                            NewChar.Width    = oldChar.Width;
                            NewChar.Sub      = oldChar.Sub;
                            NewChar.Sup      = oldChar.Sup;
                        }
                    }
                }
            }

            //***************************************

            newCell.UpdateBounds();
            return(newCell);
        }