You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Vinay Konanki <vi...@gmail.com> on 2007/02/23 08:40:38 UTC

[Tobago] How to export data to excel sheet in Tobago

Hi all,

I have very quick question.
I have data in Sheet(tc:sheet) and i need to export that data into excel
Sheet,
im using Tobago1.0.10

Can any one suggest me how i can achieve this.
is there any tags available in tobago.

I saw an example at
http://wiki.apache.org/myfaces/Exporting_DataTable_To_MS-Excel
but it uses apache tomahawk.


Thanks in advance,

Vinay

Re: Fwd: [Tobago] How to export data to excel sheet in Tobago

Posted by Vinay Konanki <vi...@gmail.com>.
Hi,
Thanks for your help, but today i found a problem with in exporting the
excel.

Problem was:
When i'm trying to export the results to excel as there are more than 700
elements to generate, it taking around 5-6 seconds to show window "which
contains OpenWith SaveAs Cancel" buttons.
In the mean while when i click on other links in the application its getting
blocked UI (i.e non editable UI with progress bar image) for infinite time.

So how can i make the screen as non editable when it generating Excel sheet.
i.e. i want to show to the user that some process is going on and make the
screen non editable i.e user can not make any actions on the screen.

Is there any way to make the screen non editable while other process is
going on.

Please help me in this regard.

Any kind of help will be appreciated. I'm running out of time, as my product
release is very soon.

Thanks,
Vinay

On 3/21/07, Stefan Hedtfeld <st...@xsoftahead.com> wrote:
>
>  Hi Vinay,
>
> this should be a question to a poi users list ... but anyway: did you see
> http://jakarta.apache.org/poi/apidocs/org/apache/poi/hssf/usermodel/HSSFSheet.html#setColumnWidth(short,%20short)<http://jakarta.apache.org/poi/apidocs/org/apache/poi/hssf/usermodel/HSSFSheet.html#setColumnWidth%28short,%20short%29>
> ?
>
> Regards,
>
> Stefan.
>
> Vinay Konanki schrieb:
>
> Thanks Stefan,
>
> Its working but the width of the cell is not enough to fit the text.
> i.e the cell width is not good enough to view the text that is displaying.
> I need to set the width size automatic (i.e something like AutoFit option)
>
> i.e the cell width should be set to max length of text value in that
> column.
>
> I walked through api of HSSF (poi) but i dont find any method to set the
> autoSize of the Column
> i have latest jar of poi-bin-3.0-alpha3-20061212 (12-Dec-2006)
>
> Any Suggestions will be appreciated .
>
> Vinay
>
> On 3/19/07, Stefan Hedtfeld < stefan.hedtfeld@xsoftahead.com> wrote:
> >
> > Hi Vinay,
> >
> > if you followed the example then you have to add a sall part (thanks
> > again to Arvid who pointed me into that direction some week ago):
> >
> >     Object response = context.getExternalContext().getResponse();
> >     if (response instanceof HttpServletResponse) {
> >       HttpServletResponse servletResponse = (HttpServletResponse)
> > response;
> >       servletResponse.setContentType("application/vnd.ms-excel");
> >       servletResponse.setHeader("Content-Disposition", "attachment;
> > filename=" + attachmentName);
> >       ...
> >     }
> >
> > I think the example is missing the "filename=" part in the header
> > information.
> >
> > Hop this helps.
> >
> > Regards,
> >
> > Stefan.
> >
> >
> > Vinay Konanki schrieb:
> > > Hi Bernd,
> > > Thank you very much, now im able to export to excel.
> > > When is open online its opening with MS Excel but  when i saves the
> > > file to hard disk it is saving as "filename.faces" instead
> > > "filename.xls ", as there is no xls extension the file is not opening
> > > with MS Excel.
> > >
> > > Controller file includes like this
> > >
> > > try {
> > >           UIData table = getData();
> > >           FacesContext context = FacesContext.getCurrentInstance ();
> > >           writeWorkbook(table,"OrderHistory",context);
> > >           context.responseComplete();
> > >       }
> > >       catch(Exception e) {
> > >           log.error(e);
> > >       }
> > >
> > > which will call writeWorkBook method by passing file name as one of
> > > the parameters.
> > >
> > > What can i include in the controller so that the file will save with
> > > ".xls" extension.?
> > >
> > > Thanks,
> > > Vinay
> > >
> > > On 3/17/07, *Bernd Bohmann * <bernd.bohmann@atanion.com
> > > <mailto: bernd.bohmann@atanion.com>> wrote:
> > >
> > >     You can add a component binding
> > >
> > >     tc:sheet binding="#{controller.table} ...
> > >
> > >     table is a UIData instance
> > >
> > >     Vinay Konanki wrote:
> > >     > Hi Bernd,
> > >     >
> > >     > Thanks for your reply.
> > >     > How can i pass the UIData from jsp to controller as
> > writeWorkBook()
> > >     > requires
> > >     > UIData object as parameter,
> > >     > I added ActionListner method to the controller where im calling
> > >     > writeWorkBook() method and passing required parameters,
> > >     > But my question is how can i pass the UIData Object, i guess i
> > >     need to get
> > >     > from UI where UIData object is nothing but sheet/table
> > >     controller in the
> > >     > UI.
> > >     > correct me if im wrong.
> > >     >
> > >     > Can you send me sample code of jsp  how i can pass UIData to
> > >     controller.
> > >     >
> > >     > My requirements are there will be sheet controller in the jsp
> > >     page which
> > >     > contains  Customer Details, there will be link called "excel
> > >     export". when
> > >     > we click on the link it has to show a popup which tells "Open /
> > >     Save as"
> > >     > window.
> > >     >
> > >     > Can i achieve the above task (popup window) with your sample
> > >     code which
> > >     > specified in your previous mail?
> > >     > Some thing like this (http://*tobago*.atanion.net/*tobago*
> > >     > -example-demo/faces/best-practice/non-
> > >     faces-response.jsp <
> > http://tobago.atanion.net/tobago-example-demo/faces/best-practice/non-faces-response.jsp
> > >)
> > >     >
> > >     > the "second one".
> > >     >
> > >     > Waiting for your reply
> > >     >
> > >     > Thanks,
> > >     > Vinay
> > >     >
> > >     >
> > >     >
> > >     > On 2/25/07, Bernd Bohmann < bernd.bohmann@atanion.com
> > >     <ma...@atanion.com>> wrote:
> > >     >>
> > >     >> Hello Vinay,
> > >     >>
> > >     >> just added an export excel example to test.
> > >     >>
> > >     >> Please look at
> > >     >>
> > >     >>
> > >     >>
> > >
> > http://svn.apache.org/repos/asf/myfaces/tobago/trunk/example/test/src/main/java/org/apache/myfaces/tobago/example/test/ExportUIDataToWorkbookUtil.java
> > >     <http://svn.apache.org/repos/asf/myfaces/tobago/trunk/example/test/src/main/java/org/apache/myfaces/tobago/example/test/ExportUIDataToWorkbookUtil.java
> > >
> > >     >>
> > >     >>
> > >     >> Regards
> > >     >>
> > >     >> Bernd
> > >     >>
> > >     >> Vinay Konanki wrote:
> > >     >> > Hi all,
> > >     >> >
> > >     >> > Please help me in this regard,
> > >     >> >
> > >     >> > Thanks,
> > >     >> > Vinay
> > >     >> >
> > >     >> > ---------- Forwarded message ----------
> > >     >> > From: Vinay Konanki < vinay.tobago@gmail.com
> > >     <ma...@gmail.com>>
> > >     >> > Date: Feb 22, 2007 11:40 PM
> > >     >> > Subject: [Tobago] How to export data to excel sheet in Tobago
> > >     >> > To: users@myfaces.apache.org <mailto:users@myfaces.apache.org
> > >
> > >     >> >
> > >     >> > Hi all,
> > >     >> >
> > >     >> > I have very quick question.
> > >     >> > I have data in Sheet(tc:sheet) and i need to export that data
> >
> > >     into
> > >     >> excel
> > >     >> > Sheet,
> > >     >> > im using Tobago1.0.10
> > >     >> >
> > >     >> > Can any one suggest me how i can achieve this.
> > >     >> > is there any tags available in tobago.
> > >     >> >
> > >     >> > Is there any examples available online.
> > >     >> >
> > >     >> >
> > >     >> > Thanks in advance,
> > >     >> >
> > >     >> > Vinay
> > >     >> >
> > >     >>
> > >     >
> > >
> > >
> >
> >
>
>

Re: Fwd: [Tobago] How to export data to excel sheet in Tobago

Posted by Stefan Hedtfeld <st...@xsoftahead.com>.
Hi Vinay,

this should be a question to a poi users list ... but anyway: did you
see
http://jakarta.apache.org/poi/apidocs/org/apache/poi/hssf/usermodel/HSSFSheet.html#setColumnWidth(short,%20short)
<http://jakarta.apache.org/poi/apidocs/org/apache/poi/hssf/usermodel/HSSFSheet.html#setColumnWidth%28short,%20short%29>?

Regards,

Stefan.

Vinay Konanki schrieb:
> Thanks Stefan,
>
> Its working but the width of the cell is not enough to fit the text.
> i.e the cell width is not good enough to view the text that is displaying.
> I need to set the width size automatic (i.e something like AutoFit
> option)
> i.e the cell width should be set to max length of text value in that
> column.
>
> I walked through api of HSSF (poi) but i dont find any method to set
> the autoSize of the Column
> i have latest jar of poi-bin-3.0-alpha3-20061212 (12-Dec-2006)
>
> Any Suggestions will be appreciated .
>
> Vinay
>
> On 3/19/07, *Stefan Hedtfeld* < stefan.hedtfeld@xsoftahead.com
> <ma...@xsoftahead.com>> wrote:
>
>     Hi Vinay,
>
>     if you followed the example then you have to add a sall part (thanks
>     again to Arvid who pointed me into that direction some week ago):
>
>         Object response = context.getExternalContext().getResponse();
>         if (response instanceof HttpServletResponse) {
>           HttpServletResponse servletResponse = (HttpServletResponse)
>     response;
>           servletResponse.setContentType("application/vnd.ms-excel");
>           servletResponse.setHeader("Content-Disposition", "attachment;
>     filename=" + attachmentName);
>           ...
>         }
>
>     I think the example is missing the "filename=" part in the header
>     information.
>
>     Hop this helps.
>
>     Regards,
>
>     Stefan.
>
>
>     Vinay Konanki schrieb:
>     > Hi Bernd,
>     > Thank you very much, now im able to export to excel.
>     > When is open online its opening with MS Excel but  when i saves the
>     > file to hard disk it is saving as "filename.faces" instead
>     > "filename.xls ", as there is no xls extension the file is not
>     opening
>     > with MS Excel.
>     >
>     > Controller file includes like this
>     >
>     > try {
>     >           UIData table = getData();
>     >           FacesContext context = FacesContext.getCurrentInstance ();
>     >           writeWorkbook(table,"OrderHistory",context);
>     >           context.responseComplete();
>     >       }
>     >       catch(Exception e) {
>     >           log.error(e);
>     >       }
>     >
>     > which will call writeWorkBook method by passing file name as one of
>     > the parameters.
>     >
>     > What can i include in the controller so that the file will save with
>     > ".xls" extension.?
>     >
>     > Thanks,
>     > Vinay
>     >
>     > On 3/17/07, *Bernd Bohmann * <bernd.bohmann@atanion.com
>     <ma...@atanion.com>
>     > <mailto: bernd.bohmann@atanion.com
>     <ma...@atanion.com>>> wrote:
>     >
>     >     You can add a component binding
>     >
>     >     tc:sheet binding="#{controller.table} ...
>     >
>     >     table is a UIData instance
>     >
>     >     Vinay Konanki wrote:
>     >     > Hi Bernd,
>     >     >
>     >     > Thanks for your reply.
>     >     > How can i pass the UIData from jsp to controller as
>     writeWorkBook()
>     >     > requires
>     >     > UIData object as parameter,
>     >     > I added ActionListner method to the controller where im
>     calling
>     >     > writeWorkBook() method and passing required parameters,
>     >     > But my question is how can i pass the UIData Object, i
>     guess i
>     >     need to get
>     >     > from UI where UIData object is nothing but sheet/table
>     >     controller in the
>     >     > UI.
>     >     > correct me if im wrong.
>     >     >
>     >     > Can you send me sample code of jsp  how i can pass UIData to
>     >     controller.
>     >     >
>     >     > My requirements are there will be sheet controller in the jsp
>     >     page which
>     >     > contains  Customer Details, there will be link called "excel
>     >     export". when
>     >     > we click on the link it has to show a popup which tells
>     "Open /
>     >     Save as"
>     >     > window.
>     >     >
>     >     > Can i achieve the above task (popup window) with your sample
>     >     code which
>     >     > specified in your previous mail?
>     >     > Some thing like this (http://*tobago*.atanion.net/*tobago*
>     >     > -example-demo/faces/best-practice/non-
>     >     faces-response.jsp
>     <http://tobago.atanion.net/tobago-example-demo/faces/best-practice/non-faces-response.jsp>)
>     >     >
>     >     > the "second one".
>     >     >
>     >     > Waiting for your reply
>     >     >
>     >     > Thanks,
>     >     > Vinay
>     >     >
>     >     >
>     >     >
>     >     > On 2/25/07, Bernd Bohmann < bernd.bohmann@atanion.com
>     <ma...@atanion.com>
>     >     <mailto:bernd.bohmann@atanion.com
>     <ma...@atanion.com>>> wrote:
>     >     >>
>     >     >> Hello Vinay,
>     >     >>
>     >     >> just added an export excel example to test.
>     >     >>
>     >     >> Please look at
>     >     >>
>     >     >>
>     >     >>
>     >    
>     http://svn.apache.org/repos/asf/myfaces/tobago/trunk/example/test/src/main/java/org/apache/myfaces/tobago/example/test/ExportUIDataToWorkbookUtil.java
>     >     <
>     http://svn.apache.org/repos/asf/myfaces/tobago/trunk/example/test/src/main/java/org/apache/myfaces/tobago/example/test/ExportUIDataToWorkbookUtil.java>
>     >     >>
>     >     >>
>     >     >> Regards
>     >     >>
>     >     >> Bernd
>     >     >>
>     >     >> Vinay Konanki wrote:
>     >     >> > Hi all,
>     >     >> >
>     >     >> > Please help me in this regard,
>     >     >> >
>     >     >> > Thanks,
>     >     >> > Vinay
>     >     >> >
>     >     >> > ---------- Forwarded message ----------
>     >     >> > From: Vinay Konanki < vinay.tobago@gmail.com
>     <ma...@gmail.com>
>     >     <mailto:vinay.tobago@gmail.com <ma...@gmail.com>>>
>     >     >> > Date: Feb 22, 2007 11:40 PM
>     >     >> > Subject: [Tobago] How to export data to excel sheet in
>     Tobago
>     >     >> > To: users@myfaces.apache.org
>     <ma...@myfaces.apache.org> <mailto:
>     users@myfaces.apache.org <ma...@myfaces.apache.org>>
>     >     >> >
>     >     >> > Hi all,
>     >     >> >
>     >     >> > I have very quick question.
>     >     >> > I have data in Sheet(tc:sheet) and i need to export
>     that data
>     >     into
>     >     >> excel
>     >     >> > Sheet,
>     >     >> > im using Tobago1.0.10
>     >     >> >
>     >     >> > Can any one suggest me how i can achieve this.
>     >     >> > is there any tags available in tobago.
>     >     >> >
>     >     >> > Is there any examples available online.
>     >     >> >
>     >     >> >
>     >     >> > Thanks in advance,
>     >     >> >
>     >     >> > Vinay
>     >     >> >
>     >     >>
>     >     >
>     >
>     >
>
>


Re: Fwd: [Tobago] How to export data to excel sheet in Tobago

Posted by Vinay Konanki <vi...@gmail.com>.
Thanks Stefan,

Its working but the width of the cell is not enough to fit the text.
i.e the cell width is not good enough to view the text that is displaying.
I need to set the width size automatic (i.e something like AutoFit option)
i.e the cell width should be set to max length of text value in that column.

I walked through api of HSSF (poi) but i dont find any method to set the
autoSize of the Column
i have latest jar of poi-bin-3.0-alpha3-20061212 (12-Dec-2006)

Any Suggestions will be appreciated .

Vinay

On 3/19/07, Stefan Hedtfeld <st...@xsoftahead.com> wrote:
>
> Hi Vinay,
>
> if you followed the example then you have to add a sall part (thanks
> again to Arvid who pointed me into that direction some week ago):
>
>     Object response = context.getExternalContext().getResponse();
>     if (response instanceof HttpServletResponse) {
>       HttpServletResponse servletResponse = (HttpServletResponse)
> response;
>       servletResponse.setContentType("application/vnd.ms-excel");
>       servletResponse.setHeader("Content-Disposition", "attachment;
> filename=" + attachmentName);
>       ...
>     }
>
> I think the example is missing the "filename=" part in the header
> information.
>
> Hop this helps.
>
> Regards,
>
> Stefan.
>
>
> Vinay Konanki schrieb:
> > Hi Bernd,
> > Thank you very much, now im able to export to excel.
> > When is open online its opening with MS Excel but  when i saves the
> > file to hard disk it is saving as "filename.faces" instead
> > "filename.xls ", as there is no xls extension the file is not opening
> > with MS Excel.
> >
> > Controller file includes like this
> >
> > try {
> >           UIData table = getData();
> >           FacesContext context = FacesContext.getCurrentInstance ();
> >           writeWorkbook(table,"OrderHistory",context);
> >           context.responseComplete();
> >       }
> >       catch(Exception e) {
> >           log.error(e);
> >       }
> >
> > which will call writeWorkBook method by passing file name as one of
> > the parameters.
> >
> > What can i include in the controller so that the file will save with
> > ".xls" extension.?
> >
> > Thanks,
> > Vinay
> >
> > On 3/17/07, *Bernd Bohmann * <bernd.bohmann@atanion.com
> > <ma...@atanion.com>> wrote:
> >
> >     You can add a component binding
> >
> >     tc:sheet binding="#{controller.table} ...
> >
> >     table is a UIData instance
> >
> >     Vinay Konanki wrote:
> >     > Hi Bernd,
> >     >
> >     > Thanks for your reply.
> >     > How can i pass the UIData from jsp to controller as
> writeWorkBook()
> >     > requires
> >     > UIData object as parameter,
> >     > I added ActionListner method to the controller where im calling
> >     > writeWorkBook() method and passing required parameters,
> >     > But my question is how can i pass the UIData Object, i guess i
> >     need to get
> >     > from UI where UIData object is nothing but sheet/table
> >     controller in the
> >     > UI.
> >     > correct me if im wrong.
> >     >
> >     > Can you send me sample code of jsp  how i can pass UIData to
> >     controller.
> >     >
> >     > My requirements are there will be sheet controller in the jsp
> >     page which
> >     > contains  Customer Details, there will be link called "excel
> >     export". when
> >     > we click on the link it has to show a popup which tells "Open /
> >     Save as"
> >     > window.
> >     >
> >     > Can i achieve the above task (popup window) with your sample
> >     code which
> >     > specified in your previous mail?
> >     > Some thing like this (http://*tobago*.atanion.net/*tobago*
> >     > -example-demo/faces/best-practice/non-
> >     faces-response.jsp<
> http://tobago.atanion.net/tobago-example-demo/faces/best-practice/non-faces-response.jsp
> >)
> >     >
> >     > the "second one".
> >     >
> >     > Waiting for your reply
> >     >
> >     > Thanks,
> >     > Vinay
> >     >
> >     >
> >     >
> >     > On 2/25/07, Bernd Bohmann < bernd.bohmann@atanion.com
> >     <ma...@atanion.com>> wrote:
> >     >>
> >     >> Hello Vinay,
> >     >>
> >     >> just added an export excel example to test.
> >     >>
> >     >> Please look at
> >     >>
> >     >>
> >     >>
> >
> http://svn.apache.org/repos/asf/myfaces/tobago/trunk/example/test/src/main/java/org/apache/myfaces/tobago/example/test/ExportUIDataToWorkbookUtil.java
> >     <
> http://svn.apache.org/repos/asf/myfaces/tobago/trunk/example/test/src/main/java/org/apache/myfaces/tobago/example/test/ExportUIDataToWorkbookUtil.java
> >
> >     >>
> >     >>
> >     >> Regards
> >     >>
> >     >> Bernd
> >     >>
> >     >> Vinay Konanki wrote:
> >     >> > Hi all,
> >     >> >
> >     >> > Please help me in this regard,
> >     >> >
> >     >> > Thanks,
> >     >> > Vinay
> >     >> >
> >     >> > ---------- Forwarded message ----------
> >     >> > From: Vinay Konanki <vinay.tobago@gmail.com
> >     <ma...@gmail.com>>
> >     >> > Date: Feb 22, 2007 11:40 PM
> >     >> > Subject: [Tobago] How to export data to excel sheet in Tobago
> >     >> > To: users@myfaces.apache.org <ma...@myfaces.apache.org>
> >     >> >
> >     >> > Hi all,
> >     >> >
> >     >> > I have very quick question.
> >     >> > I have data in Sheet(tc:sheet) and i need to export that data
> >     into
> >     >> excel
> >     >> > Sheet,
> >     >> > im using Tobago1.0.10
> >     >> >
> >     >> > Can any one suggest me how i can achieve this.
> >     >> > is there any tags available in tobago.
> >     >> >
> >     >> > Is there any examples available online.
> >     >> >
> >     >> >
> >     >> > Thanks in advance,
> >     >> >
> >     >> > Vinay
> >     >> >
> >     >>
> >     >
> >
> >
>
>

Re: Fwd: [Tobago] How to export data to excel sheet in Tobago

Posted by Stefan Hedtfeld <st...@xsoftahead.com>.
Hi Vinay,

if you followed the example then you have to add a sall part (thanks
again to Arvid who pointed me into that direction some week ago):

    Object response = context.getExternalContext().getResponse();
    if (response instanceof HttpServletResponse) {
      HttpServletResponse servletResponse = (HttpServletResponse) response;
      servletResponse.setContentType("application/vnd.ms-excel");
      servletResponse.setHeader("Content-Disposition", "attachment;
filename=" + attachmentName);
      ...
    }

I think the example is missing the "filename=" part in the header
information.

Hop this helps.

Regards,

Stefan.


Vinay Konanki schrieb:
> Hi Bernd,
> Thank you very much, now im able to export to excel.
> When is open online its opening with MS Excel but  when i saves the 
> file to hard disk it is saving as "filename.faces" instead
> "filename.xls ", as there is no xls extension the file is not opening
> with MS Excel.
>
> Controller file includes like this
>
> try {
>           UIData table = getData();
>           FacesContext context = FacesContext.getCurrentInstance ();
>           writeWorkbook(table,"OrderHistory",context);
>           context.responseComplete();
>       }
>       catch(Exception e) {
>           log.error(e);
>       }
>
> which will call writeWorkBook method by passing file name as one of
> the parameters.
>
> What can i include in the controller so that the file will save with
> ".xls" extension.?
>
> Thanks,
> Vinay
>
> On 3/17/07, *Bernd Bohmann * <bernd.bohmann@atanion.com
> <ma...@atanion.com>> wrote:
>
>     You can add a component binding
>
>     tc:sheet binding="#{controller.table} ...
>
>     table is a UIData instance
>
>     Vinay Konanki wrote:
>     > Hi Bernd,
>     >
>     > Thanks for your reply.
>     > How can i pass the UIData from jsp to controller as writeWorkBook()
>     > requires
>     > UIData object as parameter,
>     > I added ActionListner method to the controller where im calling
>     > writeWorkBook() method and passing required parameters,
>     > But my question is how can i pass the UIData Object, i guess i
>     need to get
>     > from UI where UIData object is nothing but sheet/table
>     controller in the
>     > UI.
>     > correct me if im wrong.
>     >
>     > Can you send me sample code of jsp  how i can pass UIData to
>     controller.
>     >
>     > My requirements are there will be sheet controller in the jsp
>     page which
>     > contains  Customer Details, there will be link called "excel
>     export". when
>     > we click on the link it has to show a popup which tells "Open /
>     Save as"
>     > window.
>     >
>     > Can i achieve the above task (popup window) with your sample
>     code which
>     > specified in your previous mail?
>     > Some thing like this (http://*tobago*.atanion.net/*tobago*
>     > -example-demo/faces/best-practice/non-
>     faces-response.jsp<http://tobago.atanion.net/tobago-example-demo/faces/best-practice/non-faces-response.jsp>)
>     >
>     > the "second one".
>     >
>     > Waiting for your reply
>     >
>     > Thanks,
>     > Vinay
>     >
>     >
>     >
>     > On 2/25/07, Bernd Bohmann < bernd.bohmann@atanion.com
>     <ma...@atanion.com>> wrote:
>     >>
>     >> Hello Vinay,
>     >>
>     >> just added an export excel example to test.
>     >>
>     >> Please look at
>     >>
>     >>
>     >>
>     http://svn.apache.org/repos/asf/myfaces/tobago/trunk/example/test/src/main/java/org/apache/myfaces/tobago/example/test/ExportUIDataToWorkbookUtil.java
>     <http://svn.apache.org/repos/asf/myfaces/tobago/trunk/example/test/src/main/java/org/apache/myfaces/tobago/example/test/ExportUIDataToWorkbookUtil.java>
>     >>
>     >>
>     >> Regards
>     >>
>     >> Bernd
>     >>
>     >> Vinay Konanki wrote:
>     >> > Hi all,
>     >> >
>     >> > Please help me in this regard,
>     >> >
>     >> > Thanks,
>     >> > Vinay
>     >> >
>     >> > ---------- Forwarded message ----------
>     >> > From: Vinay Konanki <vinay.tobago@gmail.com
>     <ma...@gmail.com>>
>     >> > Date: Feb 22, 2007 11:40 PM
>     >> > Subject: [Tobago] How to export data to excel sheet in Tobago
>     >> > To: users@myfaces.apache.org <ma...@myfaces.apache.org>
>     >> >
>     >> > Hi all,
>     >> >
>     >> > I have very quick question.
>     >> > I have data in Sheet(tc:sheet) and i need to export that data
>     into
>     >> excel
>     >> > Sheet,
>     >> > im using Tobago1.0.10
>     >> >
>     >> > Can any one suggest me how i can achieve this.
>     >> > is there any tags available in tobago.
>     >> >
>     >> > Is there any examples available online.
>     >> >
>     >> >
>     >> > Thanks in advance,
>     >> >
>     >> > Vinay
>     >> >
>     >>
>     >
>
>


Re: Fwd: [Tobago] How to export data to excel sheet in Tobago

Posted by Vinay Konanki <vi...@gmail.com>.
Hi Bernd,
Thank you very much, now im able to export to excel.
When is open online its opening with MS Excel but  when i saves the  file to
hard disk it is saving as "filename.faces" instead "filename.xls", as there
is no xls extension the file is not opening with MS Excel.

Controller file includes like this

try {
          UIData table = getData();
          FacesContext context = FacesContext.getCurrentInstance();
          writeWorkbook(table,"OrderHistory",context);
          context.responseComplete();
      }
      catch(Exception e) {
          log.error(e);
      }

which will call writeWorkBook method by passing file name as one of the
parameters.

What can i include in the controller so that the file will save with ".xls"
extension.?

Thanks,
Vinay

On 3/17/07, Bernd Bohmann <be...@atanion.com> wrote:
>
> You can add a component binding
>
> tc:sheet binding="#{controller.table} ...
>
> table is a UIData instance
>
> Vinay Konanki wrote:
> > Hi Bernd,
> >
> > Thanks for your reply.
> > How can i pass the UIData from jsp to controller as writeWorkBook()
> > requires
> > UIData object as parameter,
> > I added ActionListner method to the controller where im calling
> > writeWorkBook() method and passing required parameters,
> > But my question is how can i pass the UIData Object, i guess i need to
> get
> > from UI where UIData object is nothing but sheet/table controller in the
> > UI.
> > correct me if im wrong.
> >
> > Can you send me sample code of jsp  how i can pass UIData to controller.
> >
> > My requirements are there will be sheet controller in the jsp page which
> > contains  Customer Details, there will be link called "excel export".
> when
> > we click on the link it has to show a popup which tells "Open / Save as"
> > window.
> >
> > Can i achieve the above task (popup window) with your sample code which
> > specified in your previous mail?
> > Some thing like this (http://*tobago*.atanion.net/*tobago*
> > -example-demo/faces/best-practice/non-faces-response.jsp<
> http://tobago.atanion.net/tobago-example-demo/faces/best-practice/non-faces-response.jsp
> >)
> >
> > the "second one".
> >
> > Waiting for your reply
> >
> > Thanks,
> > Vinay
> >
> >
> >
> > On 2/25/07, Bernd Bohmann <be...@atanion.com> wrote:
> >>
> >> Hello Vinay,
> >>
> >> just added an export excel example to test.
> >>
> >> Please look at
> >>
> >>
> >>
> http://svn.apache.org/repos/asf/myfaces/tobago/trunk/example/test/src/main/java/org/apache/myfaces/tobago/example/test/ExportUIDataToWorkbookUtil.java
> >>
> >>
> >> Regards
> >>
> >> Bernd
> >>
> >> Vinay Konanki wrote:
> >> > Hi all,
> >> >
> >> > Please help me in this regard,
> >> >
> >> > Thanks,
> >> > Vinay
> >> >
> >> > ---------- Forwarded message ----------
> >> > From: Vinay Konanki <vi...@gmail.com>
> >> > Date: Feb 22, 2007 11:40 PM
> >> > Subject: [Tobago] How to export data to excel sheet in Tobago
> >> > To: users@myfaces.apache.org
> >> >
> >> > Hi all,
> >> >
> >> > I have very quick question.
> >> > I have data in Sheet(tc:sheet) and i need to export that data into
> >> excel
> >> > Sheet,
> >> > im using Tobago1.0.10
> >> >
> >> > Can any one suggest me how i can achieve this.
> >> > is there any tags available in tobago.
> >> >
> >> > Is there any examples available online.
> >> >
> >> >
> >> > Thanks in advance,
> >> >
> >> > Vinay
> >> >
> >>
> >
>

Re: Fwd: [Tobago] How to export data to excel sheet in Tobago

Posted by Bernd Bohmann <be...@atanion.com>.
You can add a component binding

tc:sheet binding="#{controller.table} ...

table is a UIData instance

Vinay Konanki wrote:
> Hi Bernd,
> 
> Thanks for your reply.
> How can i pass the UIData from jsp to controller as writeWorkBook() 
> requires
> UIData object as parameter,
> I added ActionListner method to the controller where im calling
> writeWorkBook() method and passing required parameters,
> But my question is how can i pass the UIData Object, i guess i need to get
> from UI where UIData object is nothing but sheet/table controller in the 
> UI.
> correct me if im wrong.
> 
> Can you send me sample code of jsp  how i can pass UIData to controller.
> 
> My requirements are there will be sheet controller in the jsp page which
> contains  Customer Details, there will be link called "excel export". when
> we click on the link it has to show a popup which tells "Open / Save as"
> window.
> 
> Can i achieve the above task (popup window) with your sample code which
> specified in your previous mail?
> Some thing like this (http://*tobago*.atanion.net/*tobago*
> -example-demo/faces/best-practice/non-faces-response.jsp<http://tobago.atanion.net/tobago-example-demo/faces/best-practice/non-faces-response.jsp>) 
> 
> the "second one".
> 
> Waiting for your reply
> 
> Thanks,
> Vinay
> 
> 
> 
> On 2/25/07, Bernd Bohmann <be...@atanion.com> wrote:
>>
>> Hello Vinay,
>>
>> just added an export excel example to test.
>>
>> Please look at
>>
>>
>> http://svn.apache.org/repos/asf/myfaces/tobago/trunk/example/test/src/main/java/org/apache/myfaces/tobago/example/test/ExportUIDataToWorkbookUtil.java 
>>
>>
>> Regards
>>
>> Bernd
>>
>> Vinay Konanki wrote:
>> > Hi all,
>> >
>> > Please help me in this regard,
>> >
>> > Thanks,
>> > Vinay
>> >
>> > ---------- Forwarded message ----------
>> > From: Vinay Konanki <vi...@gmail.com>
>> > Date: Feb 22, 2007 11:40 PM
>> > Subject: [Tobago] How to export data to excel sheet in Tobago
>> > To: users@myfaces.apache.org
>> >
>> > Hi all,
>> >
>> > I have very quick question.
>> > I have data in Sheet(tc:sheet) and i need to export that data into 
>> excel
>> > Sheet,
>> > im using Tobago1.0.10
>> >
>> > Can any one suggest me how i can achieve this.
>> > is there any tags available in tobago.
>> >
>> > Is there any examples available online.
>> >
>> >
>> > Thanks in advance,
>> >
>> > Vinay
>> >
>>
> 

Re: Fwd: [Tobago] How to export data to excel sheet in Tobago

Posted by Vinay Konanki <vi...@gmail.com>.
Hi Bernd,

Thanks for your reply.
How can i pass the UIData from jsp to controller as writeWorkBook() requires
UIData object as parameter,
I added ActionListner method to the controller where im calling
writeWorkBook() method and passing required parameters,
But my question is how can i pass the UIData Object, i guess i need to get
from UI where UIData object is nothing but sheet/table controller in the UI.
correct me if im wrong.

Can you send me sample code of jsp  how i can pass UIData to controller.

My requirements are there will be sheet controller in the jsp page which
contains  Customer Details, there will be link called "excel export". when
we click on the link it has to show a popup which tells "Open / Save as"
window.

Can i achieve the above task (popup window) with your sample code which
specified in your previous mail?
Some thing like this (http://*tobago*.atanion.net/*tobago*
-example-demo/faces/best-practice/non-faces-response.jsp<http://tobago.atanion.net/tobago-example-demo/faces/best-practice/non-faces-response.jsp>)
the "second one".

Waiting for your reply

Thanks,
Vinay



On 2/25/07, Bernd Bohmann <be...@atanion.com> wrote:
>
> Hello Vinay,
>
> just added an export excel example to test.
>
> Please look at
>
>
> http://svn.apache.org/repos/asf/myfaces/tobago/trunk/example/test/src/main/java/org/apache/myfaces/tobago/example/test/ExportUIDataToWorkbookUtil.java
>
> Regards
>
> Bernd
>
> Vinay Konanki wrote:
> > Hi all,
> >
> > Please help me in this regard,
> >
> > Thanks,
> > Vinay
> >
> > ---------- Forwarded message ----------
> > From: Vinay Konanki <vi...@gmail.com>
> > Date: Feb 22, 2007 11:40 PM
> > Subject: [Tobago] How to export data to excel sheet in Tobago
> > To: users@myfaces.apache.org
> >
> > Hi all,
> >
> > I have very quick question.
> > I have data in Sheet(tc:sheet) and i need to export that data into excel
> > Sheet,
> > im using Tobago1.0.10
> >
> > Can any one suggest me how i can achieve this.
> > is there any tags available in tobago.
> >
> > Is there any examples available online.
> >
> >
> > Thanks in advance,
> >
> > Vinay
> >
>

Re: Fwd: [Tobago] How to export data to excel sheet in Tobago

Posted by Bernd Bohmann <be...@atanion.com>.
Hello Vinay,

just added an export excel example to test.

Please look at

http://svn.apache.org/repos/asf/myfaces/tobago/trunk/example/test/src/main/java/org/apache/myfaces/tobago/example/test/ExportUIDataToWorkbookUtil.java

Regards

Bernd

Vinay Konanki wrote:
> Hi all,
> 
> Please help me in this regard,
> 
> Thanks,
> Vinay
> 
> ---------- Forwarded message ----------
> From: Vinay Konanki <vi...@gmail.com>
> Date: Feb 22, 2007 11:40 PM
> Subject: [Tobago] How to export data to excel sheet in Tobago
> To: users@myfaces.apache.org
> 
> Hi all,
> 
> I have very quick question.
> I have data in Sheet(tc:sheet) and i need to export that data into excel
> Sheet,
> im using Tobago1.0.10
> 
> Can any one suggest me how i can achieve this.
> is there any tags available in tobago.
> 
> Is there any examples available online.
> 
> 
> Thanks in advance,
> 
> Vinay
> 

Fwd: [Tobago] How to export data to excel sheet in Tobago

Posted by Vinay Konanki <vi...@gmail.com>.
Hi all,

Please help me in this regard,

Thanks,
Vinay

---------- Forwarded message ----------
From: Vinay Konanki <vi...@gmail.com>
Date: Feb 22, 2007 11:40 PM
Subject: [Tobago] How to export data to excel sheet in Tobago
To: users@myfaces.apache.org

Hi all,

I have very quick question.
I have data in Sheet(tc:sheet) and i need to export that data into excel
Sheet,
im using Tobago1.0.10

Can any one suggest me how i can achieve this.
is there any tags available in tobago.

Is there any examples available online.


Thanks in advance,

Vinay