Example #1
0
        public GridDocumentRenderer(GridDocument grid, Document document, RenderParameters parameters)
        {
            _grid       = grid;
            _document   = document;
            _parameters = parameters;

            // create a page so that we can get the dimensions. this page will be cleared from the document
            _documentPageForMetrics = _document.AddPage(_parameters.PageType, _parameters.PageOrientation);
        }
Example #2
0
        public double[] CalculateColumnWidths(Graphics g, GridDocument grid)
        {
            var columnWidths = new double[grid.ColumnCount];

            foreach (var row in grid.Rows)
            {
                var columnIndex = 0;
                foreach (var cell in row.Cells)
                {
                    var cellWidth = CalculateCellWidth(g, cell);
                    if (cellWidth > columnWidths[columnIndex])
                    {
                        columnWidths[columnIndex] = cellWidth;
                    }

                    columnIndex++;
                }
            }

            return(columnWidths);
        }