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);