Ejemplo n.º 1
0
 public void WriteTableRowBegin(float left, float height, float[] columnWidths)
 {
     if (this._state == State.InTable)
     {
         this._currentTable.WriteProperties();
         int[] array = new int[columnWidths.Length];
         int   num   = 0;
         for (int i = 0; i < array.Length; i++)
         {
             int num2 = WordOpenXmlUtils.ToTwips(columnWidths[i]);
             if ((float)(num + num2) > 31680.0)
             {
                 num2 = (int)(31680.0 - (float)num);
             }
             num     += num2;
             array[i] = num2;
         }
         this._currentTable.TableGrid.AddRow(array);
         this._state      = State.InRow;
         this._currentRow = new OpenXmlTableRowModel(this.CurrentRow, this._interleavingWriter);
         this._currentRow.RowProperties.Height    = height;
         this._currentRow.ColumnWidths            = array;
         this._currentRow.RowProperties.RowIndent = left;
     }
     else
     {
         WordOpenXmlUtils.FailCodingError();
     }
 }
        public override void Write(TextWriter output)
        {
            output.Write("<w:trPr>");
            if (this._rowIndent > 0.0)
            {
                output.Write("<w:wBefore w:w=\"");
                output.Write(WordOpenXmlUtils.ToTwips(this._rowIndent, 0f, 31680f));
                output.Write("\" w:type=\"dxa\"/>");
            }
            long num = (long)WordOpenXmlUtils.ToTwips(this._height) - (long)WordOpenXmlUtils.PointsToTwips((double)this._maxPaddingTop, 0.0, 31680.0) - WordOpenXmlUtils.PointsToTwips((double)this._maxPaddingBottom, 0.0, 31680.0);

            if (!this._ignoreRowHeight && num > 0)
            {
                output.Write("<w:trHeight w:val=\"");
                output.Write(WordOpenXmlUtils.TwipsToString(num, 0, 31680));
                output.Write(this._exactRowHeight ? "\" w:hRule=\"exact\"/>" : "\" w:hRule=\"atLeast\"/>");
            }
            output.Write("</w:trPr>");
            bool flag = this._borderTop != null || this._borderBottom != null || this._borderLeft != null || this._borderRight != null;

            if (flag || this._bgColor != null)
            {
                output.Write("<w:tblPrEx>");
            }
            if (flag)
            {
                output.Write("<w:tblBorders>");
                if (this._borderTop != null)
                {
                    this._borderTop.Write(output, "top");
                }
                if (this._borderLeft != null)
                {
                    this._borderLeft.Write(output, "left");
                }
                if (this._borderBottom != null)
                {
                    this._borderBottom.Write(output, "bottom");
                }
                if (this._borderRight != null)
                {
                    this._borderRight.Write(output, "right");
                }
                output.Write("</w:tblBorders>");
            }
            if (this._bgColor != null)
            {
                output.Write("<w:shd w:val=\"clear\" w:fill=\"");
                output.Write(this._bgColor);
                output.Write("\"/>");
            }
            if (!flag && this._bgColor == null)
            {
                return;
            }
            output.Write("</w:tblPrEx>");
        }