// print titles and headers/footers)
for (UIComponent child : uiWorksheet.getChildren())
{
if (child.getClass() == UIPrintArea.class)
{
UIPrintArea printArea = (UIPrintArea) child;
settings.setPrintArea(printArea.getFirstColumn(), printArea.getFirstRow(), printArea.getLastColumn(), printArea.getLastRow());
}
else if (child.getClass() == UIPrintTitles.class)
{
UIPrintTitles printTitles = (UIPrintTitles) child;
settings.setPrintTitles(printTitles.getFirstCol(), printTitles.getFirstRow(), printTitles.getLastCol(), printTitles.getLastRow());