Rene,
I've got the same problem and I solved this by changing the module a little bit. I've added the possibility to add a xls template in the configuration. So instead of starting with an empty xls file the export will use the updated file. In the xls file you can change all the format's you would like.
STEP 1) Create an new entity called TemplateFile -- with a reference to MxTemplate - Generalization "Filedocument"
STEP 2) Add an upload button on the form "TemplateEditExcel"
STEP 3) In the javaaction "GenerateExcelDoc" add/replace the following code (inside the xlsx case (line 82)
log.trace("Use Excel export");
if(filename == null)
{
filename = this.TemplateObject.getName().replace(" ", "_") + ".xlsx";
}
/*ADDITION*/
FileDocument templateDocument = TemplateObject.getMxTemplate_TemplateFile();
if(templateDocument == null){
export = new ExportExcel(this.getContext(), this.TemplateObject, this.InputObject)
}else{
/* NEW CONSTRUCTOR */
export = new ExportExcel(this.getContext(), this.TemplateObject, this.InputObject, templateDocument)
}
STEP 4. Add this constructor to the ExportExcel.java file
public ExportExcel(IContext context, MxTemplate template, IMendixObject inputObject, FileDocument templateFile) throws CoreException, IOException
{
super(context);
InputStream fileIn = Core.getFileDocumentContent(context, templateFile.getMendixObject());
//InputStream inp = new FileInputStream("workbook.xlsx");
this.book = new HSSFWorkbook(fileIn);
// Initialize all the styling items for the excel
this.styling = new Styling(template.getDateTimePresentation());
this.styling.setAllStyles(context, template, this.book);
this.useStyling = false;
}
Step 5: Replace inside the buildExportFile the code where the sheet is created with the following
// Create new sheet object in the excel doc.
//ADDED RB
Sheet sheet = null;
if (this.book.getSheet(mxSheet.getName()) != null){
sheet = this.book.getSheet(mxSheet.getName());
}else{
sheet = this.book.createSheet(mxSheet.getName());
}
//END ADDED RB
I never bother with the format ever again, i just asked the functional owner to update the template. That's it.