예제 #1
0
        private void InitFormat(Area area, FormatInfo previousFormatInfo)
        {
            TableFormatInfo prevTableFormatInfo = (TableFormatInfo)previousFormatInfo;
            TableRenderInfo tblRenderInfo       = new TableRenderInfo();

            tblRenderInfo.DocumentObject = _table;

            // Equalize the two borders, that are used to determine a rounded corner's border.
            // This way the innerWidth of the cell, which is got by the saved _formattedCells, is the same regardless of which corner relevant border is set.
            foreach (Row row in _table.Rows)
            {
                foreach (Cell cell in row.Cells)
                {
                    EqualizeRoundedCornerBorders(cell);
                }
            }

            _renderInfo = tblRenderInfo;

            if (prevTableFormatInfo != null)
            {
                _mergedCells      = prevTableFormatInfo.MergedCells;
                _formattedCells   = prevTableFormatInfo.FormattedCells;
                _bottomBorderMap  = prevTableFormatInfo.BottomBorderMap;
                _lastHeaderRow    = prevTableFormatInfo.LastHeaderRow;
                _connectedRowsMap = prevTableFormatInfo.ConnectedRowsMap;
                _startRow         = prevTableFormatInfo.EndRow + 1;
            }
            else
            {
                _mergedCells = new MergedCellList(_table);
                FormatCells();
                CalcLastHeaderRow();
                CreateConnectedRows();
                CreateBottomBorderMap();
                if (_doHorizontalBreak)
                {
                    CalcLastHeaderColumn();
                    CreateConnectedColumns();
                }
                _startRow = _lastHeaderRow + 1;
            }
            ((TableFormatInfo)tblRenderInfo.FormatInfo).MergedCells      = _mergedCells;
            ((TableFormatInfo)tblRenderInfo.FormatInfo).FormattedCells   = _formattedCells;
            ((TableFormatInfo)tblRenderInfo.FormatInfo).BottomBorderMap  = _bottomBorderMap;
            ((TableFormatInfo)tblRenderInfo.FormatInfo).ConnectedRowsMap = _connectedRowsMap;
            ((TableFormatInfo)tblRenderInfo.FormatInfo).LastHeaderRow    = _lastHeaderRow;
        }
예제 #2
0
        void InitFormat(Area area, FormatInfo previousFormatInfo)
        {
            TableFormatInfo prevTableFormatInfo = (TableFormatInfo)previousFormatInfo;
            TableRenderInfo tblRenderInfo       = new TableRenderInfo();

            tblRenderInfo.table = this.table;

            this.renderInfo = tblRenderInfo;

            if (prevTableFormatInfo != null)
            {
                this.mergedCells      = prevTableFormatInfo.mergedCells;
                this.formattedCells   = prevTableFormatInfo.formattedCells;
                this.bottomBorderMap  = prevTableFormatInfo.bottomBorderMap;
                this.lastHeaderRow    = prevTableFormatInfo.lastHeaderRow;
                this.connectedRowsMap = prevTableFormatInfo.connectedRowsMap;
                this.startRow         = prevTableFormatInfo.endRow + 1;
            }
            else
            {
                this.mergedCells = new MergedCellList(this.table);
                FormatCells();
                CalcLastHeaderRow();
                CreateConnectedRows();
                CreateBottomBorderMap();
                if (this.doHorizontalBreak)
                {
                    CalcLastHeaderColumn();
                    CreateConnectedColumns();
                }
                this.startRow = this.lastHeaderRow + 1;
            }
            ((TableFormatInfo)tblRenderInfo.FormatInfo).mergedCells      = this.mergedCells;
            ((TableFormatInfo)tblRenderInfo.FormatInfo).formattedCells   = this.formattedCells;
            ((TableFormatInfo)tblRenderInfo.FormatInfo).bottomBorderMap  = this.bottomBorderMap;
            ((TableFormatInfo)tblRenderInfo.FormatInfo).connectedRowsMap = this.connectedRowsMap;
            ((TableFormatInfo)tblRenderInfo.FormatInfo).lastHeaderRow    = this.lastHeaderRow;
        }
예제 #3
0
    void InitFormat(Area area, FormatInfo previousFormatInfo)
    {
      TableFormatInfo prevTableFormatInfo = (TableFormatInfo)previousFormatInfo;
      TableRenderInfo tblRenderInfo = new TableRenderInfo();
      tblRenderInfo.table = this.table;

      this.renderInfo = tblRenderInfo;

      if (prevTableFormatInfo != null)
      {
        this.mergedCells = prevTableFormatInfo.mergedCells;
        this.formattedCells = prevTableFormatInfo.formattedCells;
        this.bottomBorderMap = prevTableFormatInfo.bottomBorderMap;
        this.lastHeaderRow = prevTableFormatInfo.lastHeaderRow;
        this.connectedRowsMap = prevTableFormatInfo.connectedRowsMap;
        this.startRow = prevTableFormatInfo.endRow + 1;
      }
      else
      {
        this.mergedCells = new MergedCellList(this.table);
        FormatCells();
        CalcLastHeaderRow();
        CreateConnectedRows();
        CreateBottomBorderMap();
        if (this.doHorizontalBreak)
        {
          CalcLastHeaderColumn();
          CreateConnectedColumns();
        }
        this.startRow = this.lastHeaderRow + 1;
      }
      ((TableFormatInfo)tblRenderInfo.FormatInfo).mergedCells = this.mergedCells;
      ((TableFormatInfo)tblRenderInfo.FormatInfo).formattedCells = this.formattedCells;
      ((TableFormatInfo)tblRenderInfo.FormatInfo).bottomBorderMap = this.bottomBorderMap;
      ((TableFormatInfo)tblRenderInfo.FormatInfo).connectedRowsMap = this.connectedRowsMap;
      ((TableFormatInfo)tblRenderInfo.FormatInfo).lastHeaderRow = this.lastHeaderRow;
    }
예제 #4
0
        /// <summary>
        ///   Formats (measures) the table.
        /// </summary>
        /// <param name="area"> The area on which to fit the table. </param>
        /// <param name="previousFormatInfo"> </param>
        internal override void Format(Area area, FormatInfo previousFormatInfo)
        {
            DocumentElements elements = DocumentRelations.GetParent(_table) as DocumentElements;

            if (elements != null)
            {
                Section section = DocumentRelations.GetParent(elements) as Section;
                if (section != null)
                {
                    _doHorizontalBreak = section.PageSetup.HorizontalPageBreak;
                }
            }

            _renderInfo = new TableRenderInfo();
            InitFormat(area, previousFormatInfo);

            // Don't take any Rows higher then MaxElementHeight
            XUnit topHeight   = CalcStartingHeight();
            XUnit probeHeight = topHeight;
            XUnit offset;

            if (_startRow > _lastHeaderRow + 1 &&
                _startRow < _table.Rows.Count)
            {
                offset = _bottomBorderMap[_startRow] - topHeight;
            }
            else
            {
                offset = -CalcMaxTopBorderWidth(0);
            }

            int   probeRow       = _startRow;
            XUnit currentHeight  = 0;
            XUnit startingHeight = 0;
            bool  isEmpty        = false;

            while (probeRow < _table.Rows.Count)
            {
                bool firstProbe = probeRow == _startRow;
                probeRow = _connectedRowsMap[probeRow];
                // Don't take any Rows higher then MaxElementHeight
                probeHeight = _bottomBorderMap[probeRow + 1] - offset;
                // First test whether MaxElementHeight has been set.
                if (MaxElementHeight > 0 && firstProbe && probeHeight > MaxElementHeight - Tolerance)
                {
                    probeHeight = MaxElementHeight - Tolerance;
                }
                //if (firstProbe && probeHeight > MaxElementHeight - Tolerance)
                //    probeHeight = MaxElementHeight - Tolerance;

                //The height for the first new row(s) + headerrows:
                if (startingHeight == 0)
                {
                    if (probeHeight > area.Height)
                    {
                        isEmpty = true;
                        break;
                    }
                    startingHeight = probeHeight;
                }

                if (probeHeight > area.Height)
                {
                    break;
                }

                else
                {
                    _currRow      = probeRow;
                    currentHeight = probeHeight;
                    ++probeRow;
                }
            }
            if (!isEmpty)
            {
                TableFormatInfo formatInfo = (TableFormatInfo)_renderInfo.FormatInfo;
                formatInfo.StartRow  = _startRow;
                formatInfo._isEnding = _currRow >= _table.Rows.Count - 1;
                formatInfo.EndRow    = _currRow;
            }
            FinishLayoutInfo(area, currentHeight, startingHeight);
        }
예제 #5
0
        /// <summary>
        ///   Formats (measures) the table.
        /// </summary>
        /// <param name="area"> The area on which to fit the table. </param>
        /// <param name="previousFormatInfo"> </param>
        internal override void Format(Area area, FormatInfo previousFormatInfo)
        {
            DocumentElements elements = DocumentRelations.GetParent(_table) as DocumentElements;
            if (elements != null)
            {
                Section section = DocumentRelations.GetParent(elements) as Section;
                if (section != null)
                    _doHorizontalBreak = section.PageSetup.HorizontalPageBreak;
            }

            _renderInfo = new TableRenderInfo();
            InitFormat(area, previousFormatInfo);

            // Don't take any Rows higher then MaxElementHeight
            XUnit topHeight = CalcStartingHeight();
            XUnit probeHeight = topHeight;
            XUnit offset;
            if (_startRow > _lastHeaderRow + 1 &&
                _startRow < _table.Rows.Count)
                offset = _bottomBorderMap[_startRow] - topHeight;
            else
                offset = -CalcMaxTopBorderWidth(0);

            int probeRow = _startRow;
            XUnit currentHeight = 0;
            XUnit startingHeight = 0;
            bool isEmpty = false;

            while (probeRow < _table.Rows.Count)
            {
                bool firstProbe = probeRow == _startRow;
                probeRow = _connectedRowsMap[probeRow];
                // Don't take any Rows higher then MaxElementHeight
                probeHeight = _bottomBorderMap[probeRow + 1] - offset;
                // First test whether MaxElementHeight has been set.
                if (MaxElementHeight > 0 && firstProbe && probeHeight > MaxElementHeight - Tolerance)
                    probeHeight = MaxElementHeight - Tolerance;
                //if (firstProbe && probeHeight > MaxElementHeight - Tolerance)
                //    probeHeight = MaxElementHeight - Tolerance;

                //The height for the first new row(s) + headerrows:
                if (startingHeight == 0)
                {
                    if (probeHeight > area.Height)
                    {
                        isEmpty = true;
                        break;
                    }
                    startingHeight = probeHeight;
                }

                if (probeHeight > area.Height)
                    break;

                else
                {
                    _currRow = probeRow;
                    currentHeight = probeHeight;
                    ++probeRow;
                }
            }
            if (!isEmpty)
            {
                TableFormatInfo formatInfo = (TableFormatInfo)_renderInfo.FormatInfo;
                formatInfo.StartRow = _startRow;
                formatInfo._isEnding = _currRow >= _table.Rows.Count - 1;
                formatInfo.EndRow = _currRow;
            }
            FinishLayoutInfo(area, currentHeight, startingHeight);
        }
예제 #6
0
        private void InitFormat(Area area, FormatInfo previousFormatInfo)
        {
            TableFormatInfo prevTableFormatInfo = (TableFormatInfo)previousFormatInfo;
            TableRenderInfo tblRenderInfo = new TableRenderInfo();
            tblRenderInfo.DocumentObject = _table;

            // Equalize the two borders, that are used to determine a rounded corner's border.
            // This way the innerWidth of the cell, which is got by the saved _formattedCells, is the same regardless of which corner relevant border is set.
            foreach (Row row in _table.Rows)
                foreach (Cell cell in row.Cells)
                    EqualizeRoundedCornerBorders(cell);

            _renderInfo = tblRenderInfo;

            if (prevTableFormatInfo != null)
            {
                _mergedCells = prevTableFormatInfo.MergedCells;
                _formattedCells = prevTableFormatInfo.FormattedCells;
                _bottomBorderMap = prevTableFormatInfo.BottomBorderMap;
                _lastHeaderRow = prevTableFormatInfo.LastHeaderRow;
                _connectedRowsMap = prevTableFormatInfo.ConnectedRowsMap;
                _startRow = prevTableFormatInfo.EndRow + 1;
            }
            else
            {
                _mergedCells = new MergedCellList(_table);
                FormatCells();
                CalcLastHeaderRow();
                CreateConnectedRows();
                CreateBottomBorderMap();
                if (_doHorizontalBreak)
                {
                    CalcLastHeaderColumn();
                    CreateConnectedColumns();
                }
                _startRow = _lastHeaderRow + 1;
            }
            ((TableFormatInfo)tblRenderInfo.FormatInfo).MergedCells = _mergedCells;
            ((TableFormatInfo)tblRenderInfo.FormatInfo).FormattedCells = _formattedCells;
            ((TableFormatInfo)tblRenderInfo.FormatInfo).BottomBorderMap = _bottomBorderMap;
            ((TableFormatInfo)tblRenderInfo.FormatInfo).ConnectedRowsMap = _connectedRowsMap;
            ((TableFormatInfo)tblRenderInfo.FormatInfo).LastHeaderRow = _lastHeaderRow;
        }