◆ exportSheet()
void org.turro.financials.menu.FinancialsSheets.exportSheet |
( |
Page |
page | ) |
|
Definition at line 47 of file FinancialsSheets.java.
48 File dir =
new File(ElephantContext.getRealPath(
"/WEB-INF/_reports/financials/sheets"));
49 InputField iDate =
new InputField(
"Date",
new Date(),
null, 0);
50 InputField iFile =
new InputField(
"Sheet", dir,
"*.xls", 0);
51 ViewListbox vl =
new ViewListbox();
53 vl.setAllowNull(
true);
54 InputField iView =
new InputField(
"View", vl, ViewWrapper.getFormalView());
56 page, I_.get(
"Report sheets"),
57 new InputField[] {iDate, iFile, iView},
60 public Object execute(Context context) {
63 RegisterView view =
null;
64 InputField[] fields = (InputField[]) context.get(
"fields");
65 if(fields.length > 0) {
66 for(InputField f : fields) {
67 if(
"Date".equals(f.getLabel())) {
68 date = (Date) f.getValue();
69 }
else if(
"Sheet".equals(f.getLabel())) {
70 file = (File) f.getValue();
71 }
else if(
"View".equals(f.getLabel())) {
72 view = (RegisterView) f.getValue();
77 ReportSheet rs =
new ReportSheet(file, date, view);
78 Filedownload.save(rs.getExcel(),
new MimetypesFileTypeMap().getContentType(file.getName()), file.getName());
79 }
catch (IOException | BiffException | WriteException ex) {
80 Logger.getLogger(FinancialsSheets.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(
null), ex);
The documentation for this class was generated from the following file: