internal RowFormat(RowFormat ri)
        {
            _rowCellFormat = new CellFormat(ri.RowCellFormat);
            _cellFormats = new ArrayList();
            _widthA = new CellWidth(ri.WidthA);
            _widthB = new CellWidth(ri.WidthB);
            _widthRow = new CellWidth(ri.WidthRow);
            _nTrgaph = ri.Trgaph;
            _dir = ri.Dir;
            _nTrleft = ri._nTrleft;

            for (int i = 0; i < ri.CellCount; i++)
            {
                _cellFormats.Add(new CellFormat(ri.NthCellFormat(i)));
            }
        }
 internal RowFormat()
 {
     _rowCellFormat = new CellFormat();
     _widthA = new CellWidth();
     _widthB = new CellWidth();
     _widthRow = new CellWidth();
     _cellFormats = new ArrayList();
     _dir = DirState.DirLTR;
     _nTrgaph = -1;
     _nTrleft = 0;
 }
Пример #3
0
        /// <summary>
        /// Wirte the CellX control and value to layout the cell position on the table and
        /// return the last cell x position.
        /// There is no smart calculation for getting cell width without the specified value, 
        /// so we use DefaultCellXAsTwips(1440) magic number which is the default CellX value on Word.
        /// </summary> 
        private long WriteCellDimensions(DocumentNode dnCell, int nCol, long lastCellX) 
        {
            DocumentNode dnTable = dnCell.GetParentOfType(DocumentNodeType.dnTable); 

            if (dnTable.FormatState.HasRowFormat)
            {
                RowFormat rf = dnTable.FormatState.RowFormat; 
                CellFormat cf = rf.NthCellFormat(nCol);
 
                if (dnCell.ColSpan > 1) 
                {
                    CellFormat cfSpanned = new CellFormat(cf); 

                    for (int i = 1; i < dnCell.ColSpan; i++)
                    {
                        cf = rf.NthCellFormat(nCol + i); 
                        cfSpanned.Width.Value += cf.Width.Value;
                        cfSpanned.CellX = cf.CellX; 
                    } 

                    // Calculate the default value if CellX never set or has zero cell count 
                    if (cfSpanned.CellX == -1 || rf.CellCount == 0)
                    {
                        // Calculate the default CellX value with tables width
                        cfSpanned.CellX = lastCellX + 
                            dnCell.ColSpan * DefaultCellXAsTwips +
                            GetDefaultAllTablesWidthFromCell(dnCell); 
                    } 

                    // Write the encoded width information like as CellX control and value 
                    _rtfBuilder.Append(cfSpanned.RTFEncodingForWidth);

                    // Save the last CellX value to accumulate it with the next cell
                    lastCellX = cfSpanned.CellX; 
                }
                else 
                { 
                    if (cf.CellX == -1 || rf.CellCount == 0)
                    { 
                        // Calculate the default CellX value
                        cf.CellX = lastCellX + DefaultCellXAsTwips + GetDefaultAllTablesWidthFromCell(dnCell);
                    }
 
                    // Write the encoded width information like as CellX control and value
                    _rtfBuilder.Append(cf.RTFEncodingForWidth); 
 
                    lastCellX = cf.CellX;
                } 
            }
            else
            {
                _rtfBuilder.Append("\\clftsWidth1"); 
                _rtfBuilder.Append("\\cellx");
 
                // Set the CellX value and write the CellX control and value 
                long cellX = lastCellX + dnCell.ColSpan * DefaultCellXAsTwips;
                _rtfBuilder.Append(cellX.ToString(CultureInfo.InvariantCulture)); 

                lastCellX = cellX;
            }
 
            return lastCellX;
        } 
 internal CellFormat(CellFormat cf)
 {
     CellX = cf.CellX;
     IsCellXSet = cf.IsCellXSet;
     Width = new CellWidth(cf.Width);
     CB = cf.CB;
     CF = cf.CF;
     Shading = cf.Shading;
     PaddingTop = cf.PaddingTop;
     PaddingBottom = cf.PaddingBottom;
     PaddingRight = cf.PaddingRight;
     PaddingLeft = cf.PaddingLeft;
     BorderLeft = new BorderFormat(cf.BorderLeft);
     BorderRight = new BorderFormat(cf.BorderRight);
     BorderBottom = new BorderFormat(cf.BorderBottom);
     BorderTop = new BorderFormat(cf.BorderTop);
     SpacingTop = cf.SpacingTop;
     SpacingBottom = cf.SpacingBottom;
     SpacingRight = cf.SpacingRight;
     SpacingLeft = cf.SpacingLeft;
     VAlign = VAlign.AlignTop;
     IsPending = true;
     IsHMerge = cf.IsHMerge;
     IsHMergeFirst = cf.IsHMergeFirst;
     IsVMerge = cf.IsVMerge;
     IsVMergeFirst = cf.IsVMergeFirst;
 }
Пример #5
0
 // Token: 0x060034B1 RID: 13489 RVA: 0x000EABA4 File Offset: 0x000E8DA4
 private void ProcessTableRowSpan(DocumentNodeArray dnaTables)
 {
     for (int i = 0; i < dnaTables.Count; i++)
     {
         DocumentNode     documentNode     = dnaTables.EntryAt(i);
         ColumnStateArray columnStateArray = documentNode.ColumnStateArray;
         if (columnStateArray != null && columnStateArray.Count != 0)
         {
             int count = columnStateArray.Count;
             DocumentNodeArray tableRows         = documentNode.GetTableRows();
             DocumentNodeArray documentNodeArray = new DocumentNodeArray();
             for (int j = 0; j < count; j++)
             {
                 documentNodeArray.Add(null);
             }
             for (int k = 0; k < tableRows.Count; k++)
             {
                 DocumentNode      documentNode2 = tableRows.EntryAt(k);
                 RowFormat         rowFormat     = documentNode2.FormatState.RowFormat;
                 DocumentNodeArray rowsCells     = documentNode2.GetRowsCells();
                 int num = count;
                 if (rowFormat.CellCount < num)
                 {
                     num = rowFormat.CellCount;
                 }
                 if (rowsCells.Count < num)
                 {
                     num = rowsCells.Count;
                 }
                 int num2 = 0;
                 int num3 = 0;
                 while (num3 < num && num2 < documentNodeArray.Count)
                 {
                     DocumentNode documentNode3 = rowsCells.EntryAt(num3);
                     CellFormat   cellFormat    = rowFormat.NthCellFormat(num3);
                     if (cellFormat.IsVMerge)
                     {
                         DocumentNode documentNode4 = documentNodeArray.EntryAt(num2);
                         if (documentNode4 != null)
                         {
                             documentNode4.RowSpan++;
                         }
                         num2 += documentNode3.ColSpan;
                         documentNode3.ColSpan = 0;
                     }
                     else
                     {
                         if (cellFormat.IsVMergeFirst)
                         {
                             documentNode3.RowSpan   = 1;
                             documentNodeArray[num2] = documentNode3;
                         }
                         else
                         {
                             documentNodeArray[num2] = null;
                         }
                         for (int l = num2 + 1; l < num2 + documentNode3.ColSpan; l++)
                         {
                             documentNodeArray[l] = null;
                         }
                         num2 += documentNode3.ColSpan;
                     }
                     num3++;
                 }
             }
         }
     }
 }