Пример #1
0
 public void SetValue(ColumnSetting setting)
 {
     Index         = setting.Index;
     Display       = setting.Display;
     ColomnWidth   = setting.ColomnWidth;
     TextAlignment = setting.TextAlignment;
     IsShow        = setting.IsShow;
 }
Пример #2
0
 /// <summary>
 /// 添加列信息
 /// </summary>
 /// <param name="column"></param>
 public void AddColumns(ColumnSetting column)
 {
     if (column == null)
     {
         return;
     }
     this.ColumnSettings.Add(column);
 }
Пример #3
0
        /// <summary>
        /// 整合表头信息
        /// </summary>
        /// <param name="noteType">贯穿信息(递归过程中国年保持不变)</param>
        /// <param name="rowCount">剩余的行数</param>
        /// <param name="nodes"></param>
        /// <param name="rowIndex"></param>
        /// <param name="columnIndex"></param>
        /// <returns></returns>
        private List <TCell> GetHeaderCells(TextNoteType noteType, int rowCount, List <TNode> nodes, int rowIndex,
                                            int columnIndex)
        {
            List <TCell> cells         = new List <TCell>();
            View         currentView   = this.DrawView;
            Document     doc           = currentView.Document;
            int          currentColumn = columnIndex;
            int          currentRow    = rowIndex;

            for (int k = 0; k < nodes.Count; k++)
            {
                TNode currentNode = nodes[k];
                int   columnSpan  = currentNode.LeafCount;

                int rowUnit = rowCount / currentNode.Depth; //改树形分支剩余的行数
                int rowSpan = rowUnit;

                string        text   = currentNode.Name;
                var           leaves = currentNode.GetLeaves();
                ColumnSetting column = leaves[0].Tag as ColumnSetting;
                if (column != null)
                {
                    var data = new TextNoteData(currentView, XYZ.Zero, XYZ.BasisX, XYZ.BasisY,
                                                BaseDataSupply.ConvertToTextNodeAlgin(column.TextAlignment), text, noteType);
                    TextNote tn    = data.Create(currentView.Document);
                    TCell    tCell = null;
                    cells.Add(tCell = new TCell()
                    {
                        RowIndex    = currentRow,
                        ColumnIndex = currentColumn,
                        RowSpan     = rowSpan,
                        ColumnSpan  = columnSpan,
                        Value       = tn
                    });

                    //if (isAutoFit)
                    //{
                    double tempWidth = doc.ComputeTextNoteWidth(currentView, text, noteType).FromApi() * 0.7;
                    tCell.Tag = tempWidth;
                    //    columnsWidth[k] = columnsWidth[k].IsThanEq(tempWidth) ? columnsWidth[k] : tempWidth;
                    //}
                }

                if (!currentNode.IsLeaf)
                {
                    cells.AddRange(GetHeaderCells(noteType, rowCount - rowSpan, currentNode.Nodes, currentRow + rowSpan,
                                                  currentColumn));
                }
                currentColumn = currentColumn + columnSpan;
            }
            return(cells);
        }