Exemplo n.º 1
0
        /// <summary>
        /// Creates the next bottom border position.
        /// </summary>
        void CreateNextBottomBorderPosition()
        {
            int           lastIdx                 = bottomBorderMap.Count - 1;
            int           lastBorderRow           = (int)bottomBorderMap.GetKey(lastIdx);
            XUnit         lastPos                 = (XUnit)bottomBorderMap.GetByIndex(lastIdx);
            Cell          minMergedCell           = GetMinMergedCell(lastBorderRow);
            FormattedCell minMergedFormattedCell  = (FormattedCell)this.formattedCells[minMergedCell];
            XUnit         maxBottomBorderPosition = lastPos + minMergedFormattedCell.InnerHeight;

            maxBottomBorderPosition += CalcBottomBorderWidth(minMergedCell);

            foreach (Cell cell in this.mergedCells)
            {
                if (cell.Row.Index > minMergedCell.Row.Index + minMergedCell.MergeDown)
                {
                    break;
                }

                if (cell.Row.Index + cell.MergeDown == minMergedCell.Row.Index + minMergedCell.MergeDown)
                {
                    FormattedCell formattedCell   = (FormattedCell)this.formattedCells[cell];
                    XUnit         topBorderPos    = (XUnit)this.bottomBorderMap[cell.Row.Index];
                    XUnit         bottomBorderPos = topBorderPos + formattedCell.InnerHeight;
                    bottomBorderPos += CalcBottomBorderWidth(cell);
                    if (bottomBorderPos > maxBottomBorderPosition)
                    {
                        maxBottomBorderPosition = bottomBorderPos;
                    }
                }
            }
            this.bottomBorderMap.Add(minMergedCell.Row.Index + minMergedCell.MergeDown + 1, maxBottomBorderPosition);
        }
Exemplo n.º 2
0
        private Rectangle GetInnerRect(XUnit startingHeight, Cell cell)
        {
            BordersRenderer bordersRenderer = new BordersRenderer(_mergedCells.GetEffectiveBorders(cell), _gfx);
            FormattedCell   formattedCell   = _formattedCells[cell];
            XUnit           width           = formattedCell.InnerWidth;

            XUnit y = _startY;

            if (cell.Row.Index > _lastHeaderRow)
            {
                y += startingHeight;
            }
            else
            {
                y += CalcMaxTopBorderWidth(0);
            }

#if true
            // !!!new 18-03-09 Attempt to fix an exception. begin
            XUnit upperBorderPos;
            if (!_bottomBorderMap.TryGetValue(cell.Row.Index, out upperBorderPos))
            {
                //GetType();
            }
            // !!!new 18-03-09 Attempt to fix an exception. end
#else
            XUnit upperBorderPos = _bottomBorderMap[cell.Row.Index];
#endif

            y += upperBorderPos;
            if (cell.Row.Index > _lastHeaderRow)
            {
                y -= _bottomBorderMap[_startRow];
            }

#if true
            // !!!new 18-03-09 Attempt to fix an exception. begin
            XUnit lowerBorderPos;
            if (!_bottomBorderMap.TryGetValue(cell.Row.Index + cell.MergeDown + 1, out lowerBorderPos))
            {
                //GetType();
            }
            // !!!new 18-03-09 Attempt to fix an exception. end
#else
            XUnit lowerBorderPos = _bottomBorderMap[cell.Row.Index + cell.MergeDown + 1];
#endif

            XUnit height = lowerBorderPos - upperBorderPos;
            height -= bordersRenderer.GetWidth(BorderType.Bottom);

            XUnit x = _startX;
            for (int clmIdx = 0; clmIdx < cell.Column.Index; ++clmIdx)
            {
                x += _table.Columns[clmIdx].Width;
            }
            x += LeftBorderOffset;

            return(new Rectangle(x, y, width, height));
        }
Exemplo n.º 3
0
 void FormatCells()
 {
     this.formattedCells = new SortedList(new CellComparer());
     foreach (Cell cell in this.mergedCells)
     {
         FormattedCell formattedCell = new FormattedCell(cell, this.documentRenderer, this.mergedCells.GetEffectiveBorders(cell), this.fieldInfos, 0, 0);
         formattedCell.Format(this.gfx);
         this.formattedCells.Add(cell, formattedCell);
     }
 }
Exemplo n.º 4
0
 void FormatCells()
 {
     this.formattedCells = new Hashtable();
     foreach (Cell cell in this.mergedCells.GetCells())
     {
         FormattedCell formattedCell = new FormattedCell(cell, this.documentRenderer, this.mergedCells.GetEffectiveBorders(cell), this.fieldInfos, 0, 0);
         formattedCell.Format(this.gfx);
         this.formattedCells.Add(cell, formattedCell);
     }
 }
Exemplo n.º 5
0
 private void FormatCells()
 {
     _formattedCells = new Dictionary <Cell, FormattedCell>(); //new Sorted_List(new CellComparer());
     foreach (Cell cell in _mergedCells)
     {
         FormattedCell formattedCell = new FormattedCell(cell, _documentRenderer, _mergedCells.GetEffectiveBorders(cell),
                                                         _fieldInfos, 0, 0);
         formattedCell.Format(_gfx);
         _formattedCells.Add(cell, formattedCell);
     }
 }
Exemplo n.º 6
0
        /// <summary>
        ///   Creates the next bottom border position.
        /// </summary>
        private void CreateNextBottomBorderPosition()
        {
            //int lastIdx = _bottomBorderMap.Count - 1;
            // SortedList version:
            //int lastBorderRow = (int)bottomBorderMap.GetKey(lastIdx);
            //XUnit lastPos = (XUnit)bottomBorderMap.GetByIndex(lastIdx);
            int lastBorderRow = 0;

            foreach (int key in _bottomBorderMap.Keys)
            {
                if (key > lastBorderRow)
                {
                    lastBorderRow = key;
                }
            }
            XUnit lastPos = _bottomBorderMap[lastBorderRow];

            Cell          minMergedCell           = GetMinMergedCell(lastBorderRow);
            FormattedCell minMergedFormattedCell  = _formattedCells[minMergedCell];
            XUnit         maxBottomBorderPosition = lastPos + minMergedFormattedCell.InnerHeight;

            maxBottomBorderPosition += CalcBottomBorderWidth(minMergedCell);

            foreach (Cell cell in _mergedCells)
            {
                if (cell.Row.Index > minMergedCell.Row.Index + minMergedCell.MergeDown)
                {
                    break;
                }

                if (cell.Row.Index + cell.MergeDown == minMergedCell.Row.Index + minMergedCell.MergeDown)
                {
                    FormattedCell formattedCell   = _formattedCells[cell];
                    XUnit         topBorderPos    = _bottomBorderMap[cell.Row.Index];
                    XUnit         bottomBorderPos = topBorderPos + formattedCell.InnerHeight;
                    bottomBorderPos += CalcBottomBorderWidth(cell);
                    if (bottomBorderPos > maxBottomBorderPosition)
                    {
                        maxBottomBorderPosition = bottomBorderPos;
                    }
                }
            }
            _bottomBorderMap.Add(minMergedCell.Row.Index + minMergedCell.MergeDown + 1, maxBottomBorderPosition);
        }
Exemplo n.º 7
0
        private Rectangle GetInnerRect(XUnit startingHeight, Cell cell)
        {
            BordersRenderer bordersRenderer = new BordersRenderer(_mergedCells.GetEffectiveBorders(cell), _gfx);
            FormattedCell   formattedCell   = _formattedCells[cell];
            XUnit           width           = formattedCell.InnerWidth;

            XUnit y = _startY;

            if (cell.Row.Index > _lastHeaderRow)
            {
                y += startingHeight;
            }
            else
            {
                y += CalcMaxTopBorderWidth(0);
            }

            XUnit upperBorderPos = _bottomBorderMap[cell.Row.Index];

            y += upperBorderPos;
            if (cell.Row.Index > _lastHeaderRow)
            {
                y -= _bottomBorderMap[_startRow];
            }

            XUnit lowerBorderPos = _bottomBorderMap[cell.Row.Index + cell.MergeDown + 1];


            XUnit height = lowerBorderPos - upperBorderPos;

            height -= bordersRenderer.GetWidth(BorderType.Bottom);

            XUnit x = _startX;

            for (int clmIdx = 0; clmIdx < cell.Column.Index; ++clmIdx)
            {
                x += _table.Columns[clmIdx].Width;
            }
            x += LeftBorderOffset;

            return(new Rectangle(x, y, width, height));
        }
Exemplo n.º 8
0
        private void RenderContent(Cell cell, Rectangle innerRect)
        {
            FormattedCell formattedCell = _formattedCells[cell];

            RenderInfo[] renderInfos = formattedCell.GetRenderInfos();

            if (renderInfos == null)
            {
                return;
            }

            VerticalAlignment verticalAlignment = cell.VerticalAlignment;
            XUnit             contentHeight     = formattedCell.ContentHeight;
            XUnit             innerHeight       = innerRect.Height;
            XUnit             targetX           = innerRect.X + cell.Column.LeftPadding;

            XUnit targetY;

            if (verticalAlignment == VerticalAlignment.Bottom)
            {
                targetY  = innerRect.Y + innerRect.Height;
                targetY -= cell.Row.BottomPadding;
                targetY -= contentHeight;
            }
            else if (verticalAlignment == VerticalAlignment.Center)
            {
                targetY  = innerRect.Y + cell.Row.TopPadding;
                targetY += innerRect.Y + innerRect.Height - cell.Row.BottomPadding;
                targetY -= contentHeight;
                targetY /= 2;
            }
            else
            {
                targetY = innerRect.Y + cell.Row.TopPadding;
            }

            RenderByInfos(targetX, targetY, renderInfos);
        }
Exemplo n.º 9
0
 void FormatCells()
 {
   this.formattedCells = new SortedList(new CellComparer());
   foreach (Cell cell in this.mergedCells)
   {
     FormattedCell formattedCell = new FormattedCell(cell, this.documentRenderer, this.mergedCells.GetEffectiveBorders(cell), this.fieldInfos, 0, 0);
     formattedCell.Format(this.gfx);
     this.formattedCells.Add(cell, formattedCell);
   }
 }
Exemplo n.º 10
0
        /// <summary>
        ///   Creates the next bottom border position.
        /// </summary>
        private void CreateNextBottomBorderPosition()
        {
            //int lastIdx = _bottomBorderMap.Count - 1;
            // SortedList version:
            //int lastBorderRow = (int)bottomBorderMap.GetKey(lastIdx);
            //XUnit lastPos = (XUnit)bottomBorderMap.GetByIndex(lastIdx);
            int lastBorderRow = 0;

            foreach (int key in _bottomBorderMap.Keys)
            {
                if (key > lastBorderRow)
                {
                    lastBorderRow = key;
                }
            }
            XUnit lastPos = _bottomBorderMap[lastBorderRow];

            Cell          minMergedCell           = GetMinMergedCell(lastBorderRow);
            FormattedCell minMergedFormattedCell  = _formattedCells[minMergedCell];
            XUnit         maxBottomBorderPosition = lastPos + minMergedFormattedCell.InnerHeight;

            maxBottomBorderPosition += CalcBottomBorderWidth(minMergedCell);

            foreach (Cell cell in _mergedCells)
            {
                if (cell.Row.Index > minMergedCell.Row.Index + minMergedCell.MergeDown)
                {
                    break;
                }

                if (cell.Row.Index + cell.MergeDown == minMergedCell.Row.Index + minMergedCell.MergeDown)
                {
                    FormattedCell formattedCell = _formattedCells[cell];
                    // !!!new 18-03-09 Attempt to fix an exception. begin
                    // if (cell.Row.Index < _bottomBorderMap.Count)
                    {
                        // !!!new 18-03-09 Attempt to fix an exception. end
#if true
                        // !!!new 18-03-09 Attempt to fix an exception. begin
                        XUnit topBorderPos = maxBottomBorderPosition;
                        if (!_bottomBorderMap.TryGetValue(cell.Row.Index, out topBorderPos))
                        {
                            //GetType();
                        }
                        // !!!new 18-03-09 Attempt to fix an exception. end
#else
                        XUnit topBorderPos = _bottomBorderMap[cell.Row.Index];
#endif
                        XUnit bottomBorderPos = topBorderPos + formattedCell.InnerHeight;
                        bottomBorderPos += CalcBottomBorderWidth(cell);
                        if (bottomBorderPos > maxBottomBorderPosition)
                        {
                            maxBottomBorderPosition = bottomBorderPos;
                        }
                        // !!!new 18-03-09 Attempt to fix an exception. begin
                    }
                    // !!!new 18-03-09 Attempt to fix an exception. end
                }
            }
            _bottomBorderMap.Add(minMergedCell.Row.Index + minMergedCell.MergeDown + 1, maxBottomBorderPosition);
        }
Exemplo n.º 11
0
 private void FormatCells()
 {
     _formattedCells = new Dictionary<Cell, FormattedCell>(); //new Sorted_List(new CellComparer());
     foreach (Cell cell in _mergedCells)
     {
         FormattedCell formattedCell = new FormattedCell(cell, _documentRenderer, _mergedCells.GetEffectiveBorders(cell),
                                                         _fieldInfos, 0, 0);
         formattedCell.Format(_gfx);
         _formattedCells.Add(cell, formattedCell);
     }
 }