Hi,

I am trying to export data to csv in my wicket pages. I am using
CSVDataExporter for this purpose. Due to some constraints I am not using it
in conjunction to ExportToolbar. There is a link and on click of the link I
am trying to call exportData() on instance of CSVDataExporter. 
I am using AbstractExportableColumn for columns writing data to columns. 

However I am getting a compile time error on exportData. Follwoing is the
code (excelDataImport is the link here ):

excelDataImport.add(new AjaxEventBehavior("onclick") {
                        private static final long serialVersionUID = 1L;

                        protected void onEvent(AjaxRequestTarget target) {
                                List<IExportableColumn&lt;AffiliateModel, 
String, String>> columns = new
ArrayList<IExportableColumn&lt;AffiliateModel, String, String>>();
                                columns.add(new 
AbstractExportableColumn<AffiliateModel, String,
String>(new Model<String>("Affiliate Name"), "name") {

                                        @Override
                                        public IModel<String> getDataModel(
                                                        IModel<AffiliateModel> 
arg0) {
                                                // TODO Auto-generated method 
stub
                                                return null;
                                        }
                                        
                                });
                                
                                try {
                                        new CSVDataExporter().exportData(new 
AffiliateDataProvider(null),
columns, new FileOutputStream("test.xls"));
                                } catch (FileNotFoundException e) {
                                        // TODO Auto-generated catch block
                                        e.printStackTrace();
                                } catch (IOException e) {
                                        // TODO Auto-generated catch block
                                        e.printStackTrace();
                                } catch (Exception e) {
                                        // TODO Auto-generated catch block
                                        e.printStackTrace();
                                }

                                
                                

                        }
                });

The error message is  : "The method exportData(IDataProvider<T>,
List<IExportableColumn&lt;T,?,?>>, OutputStream) in the type CSVDataExporter
is not applicable for the arguments (AffiliateDataProvider,
List<IExportableColumn&lt;AffiliateModel,String,String>>,
FileOutputStream)".

I think I did it all correctly (as per whatever knowledge I could get on
this subject), am I doing something wrong here?

Also, can anyone share with me some sample examples and description/details
for CSVDataExporter? I have gone through example in  DataTablePage.java in
wicket example but that is using  DataTable and ExportToolbar. 

Thanks,
Suvojit

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-to-use-CSVDataExporter-tp4668270.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to