boolean allowRowResize = false;
int maxBottomPadding = 0; //for some strange reason, the bottom margin affects the row height; subtracting it here
for(int col = 0; col < grid[0].length; col++)
{
JRExporterGridCell gridCell = grid[row][col];
JRLineBox box = gridCell.getBox();
if (
box != null
&& box.getBottomPadding() != null
&& maxBottomPadding < box.getBottomPadding().intValue()
)
{
maxBottomPadding = box.getBottomPadding().intValue();
}
allowRowResize =
flexibleRowHeight
&& (allowRowResize
|| (gridCell.getElement() instanceof JRPrintText
|| (gridCell.getType() == JRExporterGridCell.TYPE_OCCUPIED_CELL
&& ((OccupiedGridCell)gridCell).getOccupier().getElement() instanceof JRPrintText)
)
);
}
int rowHeight = gridLayout.getRowHeight(row) - maxBottomPadding;
tableHelper.exportRowHeader(
rowHeight,
allowRowResize
);
for(int col = 0; col < grid[0].length; col++)
{
JRExporterGridCell gridCell = grid[row][col];
if (gridCell.getType() == JRExporterGridCell.TYPE_OCCUPIED_CELL)
{
if (emptyCellColSpan > 0)
{
//tableHelper.exportEmptyCell(gridCell, emptyCellColSpan);
emptyCellColSpan = 0;
emptyCellWidth = 0;
}
OccupiedGridCell occupiedGridCell = (OccupiedGridCell)gridCell;
ElementGridCell elementGridCell = (ElementGridCell)occupiedGridCell.getOccupier();
tableHelper.exportOccupiedCells(elementGridCell);
col += elementGridCell.getColSpan() - 1;
}
else if(gridCell.getWrapper() != null)
{
if (emptyCellColSpan > 0)
{
//writeEmptyCell(tableHelper, gridCell, emptyCellColSpan, emptyCellWidth, rowHeight);
emptyCellColSpan = 0;
emptyCellWidth = 0;
}
element = gridCell.getWrapper().getElement();
if (element instanceof JRPrintLine)
{
exportLine(tableHelper, (JRPrintLine)element, gridCell);
}
else if (element instanceof JRPrintRectangle)
{
exportRectangle(tableHelper, (JRPrintRectangle)element, gridCell);
}
else if (element instanceof JRPrintEllipse)
{
exportEllipse(tableHelper, (JRPrintEllipse)element, gridCell);
}
else if (element instanceof JRPrintImage)
{
exportImage(tableHelper, (JRPrintImage)element, gridCell);
}
else if (element instanceof JRPrintText)
{
exportText(tableHelper, (JRPrintText)element, gridCell);
}
else if (element instanceof JRPrintFrame)
{
exportFrame(tableHelper, (JRPrintFrame)element, gridCell);
}
else if (element instanceof JRGenericPrintElement)
{
exportGenericElement(tableHelper, (JRGenericPrintElement)element, gridCell);
}
col += gridCell.getColSpan() - 1;
}
else
{
emptyCellColSpan++;
emptyCellWidth += gridCell.getWidth();
tableHelper.exportEmptyCell(gridCell, 1);
}
}
// if (emptyCellColSpan > 0)