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* < [EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>> 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 * <[EMAIL PROTECTED]
>     <mailto:[EMAIL PROTECTED]>
>     > <mailto: [EMAIL PROTECTED]
>     <mailto:[EMAIL PROTECTED]>>> 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 < [EMAIL PROTECTED]
>     <mailto:[EMAIL PROTECTED]>
>     >     <mailto:[EMAIL PROTECTED]
>     <mailto:[EMAIL PROTECTED]>>> 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 < [EMAIL PROTECTED]
>     <mailto:[EMAIL PROTECTED]>
>     >     <mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>>
>     >     >> > Date: Feb 22, 2007 11:40 PM
>     >     >> > Subject: [Tobago] How to export data to excel sheet in
>     Tobago
>     >     >> > To: [email protected]
>     <mailto:[email protected]> <mailto:
>     [email protected] <mailto:[email protected]>>
>     >     >> >
>     >     >> > 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
>     >     >> >
>     >     >>
>     >     >
>     >
>     >
>
>

Reply via email to