Closed GoogleCodeExporter closed 9 years ago
You should move your check of the limit.isExported() before you work with the
table
and set the column properties based on whether or not you are doing an export.
Also, if you call the tablefacade.setColumnProperties() then you do not have to
build
the table with the HtmlComponentFactory. Just pull the table from the
tableFacade,
which builds the table, and then modify the row and columns as needed. Try
looking at
the basic example for more information.
http://code.google.com/p/jmesa/wiki/BasicTutorial
There is really nothing wrong with building using the HtmlComponentFactory. It
is
just not necessary when you set the column properties ahead of time.
Or, you might want to try using the new builder class.
http://code.google.com/p/jmesa/wiki/HtmlTableBuilder
Original comment by jeff.johnston.mn@gmail.com
on 11 Mar 2010 at 2:52
Thanks for you response!!
I've followed your indications and it's OK!! ;) I've a new problem to export.
Export
to PDF is OK, but if I export to CSV or Excel, the cell with the information
show it:
"[td]....value1...[/td]" "[td]....value1...[/td]" (I don't use '<' because
visually
it can't modify this post ;D).
So I found this reference: http://code.google.com/p/jmesa/wiki/Exports
My problem is JMesa2.4.6 don`t exist ExcelComponentFactory. With
CsvComponentFactory
isn´t problem (the CSV export is right), but with Excel... This is my code:
if (limit.isExported()) {
if (limit.getExportType() == ExportType.JEXCEL) {
ExcelComponentFactory factoryExcel = new
ExcelComponentFactory(tablefacade.getWebContext(),
tablefacade.getCoreContext());
Table table = factoryExcel.createTable();
Row row = factoryExcel.createRow();
Column col = factoryExcel.createColumn("fecha");
col.getCellRenderer().setCellEditor(new DateCellEditor("dd/MM/yyyy"));
row.addColumn(col);
col = factoryExcel.createColumn("titular");
row.addColumn(col);
col = factoryExcel.createColumn("prioridad");
row.addColumn(col);
table.setRow(row); // be sure to set the row on the table
tablefacade.setTable(table);
}else if (limit.getExportType() == ExportType.CSV) {
CsvComponentFactory factoryCsv = new
CsvComponentFactory(tablefacade.getWebContext(), tablefacade.getCoreContext());
Table table = factoryCsv.createTable();
Row row = factoryCsv.createRow();
Column col = factoryCsv.createColumn("fecha");
col.getCellRenderer().setCellEditor(new DateCellEditor("dd/MM/yyyy"));
row.addColumn(col);
col = factoryCsv.createColumn("titular");
row.addColumn(col);
col = factoryCsv.createColumn("prioridad");
row.addColumn(col);
table.setRow(row); // be sure to set the row on the table
tablefacade.setTable(table);
}else{
HtmlComponentFactory factory = new
HtmlComponentFactory(tablefacade.getWebContext(), tablefacade.getCoreContext());
Table table = factory.createTable();
Row row = factory.createRow();
HtmlColumn col = factory.createColumn("fecha");
col.setEditable(false);
col.getCellRenderer().setCellEditor(new DateCellEditor("dd/MM/yyyy"));
row.addColumn(col);
col = factory.createColumn("titular");
col.setEditable(false);
row.addColumn(col);
col = factory.createColumn("prioridad");
col.setEditable(false);
row.addColumn(col);
table.setRow(row); // be sure to set the row on the table
tablefacade.setTable(table);
}
tablefacade.render();
} else {
.....
}
--------------
Excel exporting with HtmlComponentFactory is wrong too. ARRRRGGHH!! :D Any
idea??
Thanks for your time and patience :D
Original comment by andyned...@gmail.com
on 11 Mar 2010 at 8:11
Well... I changed my heavy code to this one, and it's all right for ever and
ever!! :D
if (limit.isExported()) {
tablefacade.setColumnProperties("fecha", "titular", "prioridad");
Table table = tablefacade.getTable();
table.setCaption("Noticias");
Row row = table.getRow();
Column fecha = row.getColumn("fecha");
fecha.getCellRenderer().setCellEditor(new DateCellEditor("dd/MM/yyyy"));
tablefacade.render();
} else { ... }
Thanks so much!! I see you in another "ISSUES" XD
Original comment by andyned...@gmail.com
on 11 Mar 2010 at 10:00
Original comment by jeff.johnston.mn@gmail.com
on 13 Apr 2010 at 7:04
Original issue reported on code.google.com by
andyned...@gmail.com
on 10 Mar 2010 at 11:39