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; }
private void InitRendering() { TableFormatInfo formatInfo = (TableFormatInfo)_renderInfo.FormatInfo; _bottomBorderMap = formatInfo.BottomBorderMap; _connectedRowsMap = formatInfo.ConnectedRowsMap; _formattedCells = formatInfo.FormattedCells; _currRow = formatInfo.StartRow; _startRow = formatInfo.StartRow; _endRow = formatInfo.EndRow; _mergedCells = formatInfo.MergedCells; _lastHeaderRow = formatInfo.LastHeaderRow; _startX = _renderInfo.LayoutInfo.ContentArea.X; _startY = _renderInfo.LayoutInfo.ContentArea.Y; }
void InitRendering() { TableFormatInfo formatInfo = (TableFormatInfo)this.renderInfo.FormatInfo; this.bottomBorderMap = formatInfo.bottomBorderMap; this.connectedRowsMap = formatInfo.connectedRowsMap; this.formattedCells = formatInfo.formattedCells; this.currRow = formatInfo.startRow; this.startRow = formatInfo.startRow; this.endRow = formatInfo.endRow; this.mergedCells = formatInfo.mergedCells; this.lastHeaderRow = formatInfo.lastHeaderRow; this.startX = this.renderInfo.LayoutInfo.ContentArea.X; this.startY = this.renderInfo.LayoutInfo.ContentArea.Y; }
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; }
/// <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); }
/// <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(this.table) as DocumentElements; if (elements != null) { Section section = DocumentRelations.GetParent(elements) as Section; if (section != null) { this.doHorizontalBreak = section.PageSetup.HorizontalPageBreak; } } this.renderInfo = new TableRenderInfo(); InitFormat(area, previousFormatInfo); // Don't take any Rows higher then MaxElementHeight XUnit topHeight = this.CalcStartingHeight(); XUnit probeHeight = topHeight; XUnit offset = 0; if (this.startRow > this.lastHeaderRow + 1 && this.startRow < this.table.Rows.Count) //!!!newTHHO 09.08.2006 { offset = (XUnit)this.bottomBorderMap[this.startRow] - topHeight; } else { offset = -CalcMaxTopBorderWidth(0); } int probeRow = this.startRow; XUnit currentHeight = 0; XUnit startingHeight = 0; bool isEmpty = false; while (probeRow < this.table.Rows.Count) { bool firstProbe = probeRow == this.startRow; probeRow = (int)this.connectedRowsMap[probeRow]; // Don't take any Rows higher then MaxElementHeight probeHeight = (XUnit)this.bottomBorderMap[probeRow + 1] - offset; 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 { this.currRow = probeRow; currentHeight = probeHeight; ++probeRow; } } if (!isEmpty) { TableFormatInfo formatInfo = (TableFormatInfo)this.renderInfo.FormatInfo; formatInfo.startRow = this.startRow; //formatInfo.isEnding = currRow == this.table.Rows.Count - 1; //!!!delTHHO 09.08.2006 schöne Endlosschleife formatInfo.isEnding = currRow >= this.table.Rows.Count - 1; //!!!newTHHO 09.08.2006 formatInfo.endRow = this.currRow; } FinishLayoutInfo(area, currentHeight, startingHeight); }