When the spreadsheet contains empty rows and the format of some cells is set the rows are still exported to pdf or printed.
To workaround this set the print area with the following code:
IPropertyDefinition[] propertyDefinitionsAffectiingPringing = new IPropertyDefinition[] { CellPropertyDefinitions.ValueProperty };
CellRange usedCellRange = workbook.Worksheets[0].GetUsedCellRange(propertyDefinitionsAffectiingPringing);
workbook.Worksheets[0].WorksheetPageSetup.PrintArea.SetPrintArea(usedCellRange);