final Input input,
final Map<String, Class<?>> columns) throws JRException, ClassNotFoundException, IOException {
byte[] bytes = input.template.getConfiguration().loadFile(this.jasperTemplate);
final JasperDesign templateDesign = JRXmlLoader.load(new ByteArrayInputStream(bytes));
int headerHeight = templateDesign.getColumnHeader().getHeight();
final JRDesignSection detailSection = (JRDesignSection) templateDesign.getDetailSection();
int detailHeight = detailSection.getBands()[0].getHeight();
final JRElement sampleHeaderEl = templateDesign.getColumnHeader().getElements()[0];
int headerPosX = sampleHeaderEl.getX();
int headerPosY = sampleHeaderEl.getY();
final JRElement sampleDetailEl = detailSection.getBands()[0].getElements()[0];
int detailPosX = sampleDetailEl.getX();
int detailPosY = sampleDetailEl.getY();
clearFields(templateDesign);
removeDetailBand(templateDesign);
JRDesignBand headerBand = new JRDesignBand();
headerBand.setHeight(headerHeight);
templateDesign.setColumnHeader(headerBand);
JRDesignBand detailBand = new JRDesignBand();
detailBand.setHeight(detailHeight);
detailSection.addBand(detailBand);
final int columnWidth;
final int numColumns = columns.size();
if (columns.isEmpty()) {
columnWidth = templateDesign.getPageWidth();