public IntermediatePage GatherColumns(Graphics g, List <GridDocumentRow> pageRows, double[] columnWidths, double scale) { var page = new IntermediatePage(); // loop through all rows double y = _parameters.TopMargin; foreach (var row in pageRows) { double height = CalculateRowHeight(g, row) * scale; double x = _parameters.LeftMargin; var rowCells = new List <IntermediatePageCell>(); var summedColumnWidth = _parameters.LeftMargin + _parameters.RightMargin; // add repeated columns int index; for (index = 0; index < _parameters.RepeatColumns; index++) { double width = columnWidths[index] * scale; var cell = row.Cells[index]; rowCells.Add(new IntermediatePageCell(row, cell, x, y, width, height)); summedColumnWidth += width; x += width; } // add more columns until no more will fit. or all columns if autofitcolumns index = currentColumnOffset + _parameters.RepeatColumns; while (index < _grid.ColumnCount && (summedColumnWidth < _documentPageForMetrics.Width || _parameters.AutofitColumns)) { double width = columnWidths[index] * scale; var cell = row.Cells[index]; rowCells.Add(new IntermediatePageCell(row, cell, x, y, width, height)); summedColumnWidth += width; x += width; index++; } y += height; page.PageCells.Add(rowCells); } return(page); }
private void StepToNextPage(IntermediatePage page) { //if (currentColumnOffset == 0) //{ // currentColumnOffset += page.ColumnCount; //} //else //{ currentColumnOffset += page.ColumnCount - _parameters.RepeatColumns; //} if (currentColumnOffset >= (_grid.ColumnCount - _parameters.RepeatColumns)) { currentColumnOffset = 0; //if (currentRowOffset == 0) //{ // currentRowOffset += page.RowCount; //} //else //{ currentRowOffset += page.RowCount - _parameters.RepeatRows; //} } }