0
Ich benutze Vaadin in meinem Projekt, und ich kann nicht verstehen, wie Export Grid zu übertreffen.Wie Exportraster in Vaadin übertreffen?
ich habe:
Grid<Vlr> gridVlr = new Grid<>("Vlrs");
gridBank.setItems(VlrList); // i used ArrayList
gridBank.addColumn(Vlr::getVlrId).setCaption("VlrId");
ExportExcelComponentConfiguration<Vlr> componentConfig1
= new ExportExcelComponentConfigurationBuilder<Vlr>()
.withGrid(gridVlr)
.withVisibleProperties(new String[]{"Vlr ID"})
.withHeaderConfigs(Arrays.asList(
new ComponentHeaderConfigurationBuilder()
.withAutoFilter(true)
.withColumnKeys(new String[]{"Vlr Id"})
.build()
))
.withIntegerFormattingProperties(Arrays.asList("counter"))
.withFloatFormattingProperties(Arrays.asList(
"totalCosts",
"differenceToMin"
))
.withBooleanFormattingProperties(Arrays.asList("active"))
// .withColumnFormatters(columnFormatters)
.build();
ExportExcelSheetConfiguration<Vlr> sheetConfig1
= new ExportExcelSheetConfigurationBuilder<Vlr>()
.withReportTitle("Grid (Default)")
.withSheetName("Grid (default)")
.withComponentConfigs(Arrays.asList(componentConfig1))
.withIsHeaderSectionRequired(Boolean.TRUE)
.withDateFormat("dd-MMM-yyyy")
.build();
ExportExcelConfiguration<Vlr> config
= new ExportExcelConfigurationBuilder<Vlr>()
.withGeneratedBy("Roman")
.withSheetConfigs(Arrays.asList(sheetConfig1))
.build();
ExportToExcel exportToExcel = new ExportToExcel(ExportType.XLSX, null);
Button buttonExport = new Button("Export to Excel", clickEvent -> {
exportToExcel.export();
});
layout.addComponent(buttonExport);
Was mein Fehler ist? Vielleicht gibt es eine einfachere Lösung?
Sie vergessen zu sagen, welches Problem Sie haben. Das könnte es den Leuten leichter machen herauszufinden, was der Fehler sein könnte. – ADyson