Open GoogleCodeExporter opened 8 years ago
I totally agree that we need this! There a few things that I would like to do
for the
exports to make them more flexible.
For now you can just do this. Like everything in JMesa, I really try to expose
as
much as the API as I can so tweaking things to work is not that much
work...although
I agree that an improvement to the API is needed.
/**
* Override the renderExport() method so that we can insert a custom file name.
*/
private static class CustomTableFacade extends TableFacadeImpl {
private HttpServletResponse response;
private String fileName;
public CustomTableFacade(String id, HttpServletRequest request,
HttpServletResponse response,
JpaContestDrawing drawing) {
super(id, request);
this.response = response;
DateTime startDate = drawing.getStartDate();
DateTime endDate = drawing.getEndDate();
String contestName = drawing.getContest().getName();
fileName = contestName + "_" + startDate.toString("MM-dd-yyyy") + "_" +
endDate.toString("MM-dd-yyyy") + ".xls";
}
@Override
protected void renderExport(ExportType exportType, View view) {
try {
if (exportType == ExportType.JEXCEL) {
new JExcelViewExporter(view, getCoreContext(), response,
fileName).export();
} else {
super.renderExport(exportType, view);
}
} catch (Exception e) {
logger.error("Not able to perform the " + exportType + " export.", e);
}
}
}
Original comment by jeff.johnston.mn@gmail.com
on 5 Oct 2009 at 3:07
Did this work for you?
Original comment by jeff.johnston.mn@gmail.com
on 22 Oct 2009 at 5:53
Yes, thank you!
And in the future you will improve the possibility of existing API, so you can
do
without such hacks?
Original comment by stas.agarkov
on 5 Nov 2009 at 2:45
Original issue reported on code.google.com by
stas.agarkov
on 5 Oct 2009 at 8:10