[prev in list] [next in list] [prev in thread] [next in thread]
List: poi-user
Subject: Re: Automatically expanding each column to accomodate largest/widest cell using POI-HSSF
From: Sanjiv Jivan <sanjiv.jivan () gmail ! com>
Date: 2005-04-26 12:46:27
Message-ID: a17839be0504260546780a2bb5 () mail ! gmail ! com
[Download RAW message or body]
Not sure if HHSF has an API for this but you can add the following
code in the Open subroutine of your workbook.
Private Sub Workbook_Open()
Dim i As Integer
Application.ScreenUpdating = False
For i = 1 To Sheet1.UsedRange.Columns.Count
Sheet1.UsedRange.Columns(i).EntireColumn.AutoFit
Next
Application.ScreenUpdating = True
End Sub
Hope this helps,
Sanjiv
On 4/26/05, John Sims <SimsJ1@wyeth.com> wrote:
> Hi,
>
> I'm using POI-HSSF in a JSP application to stream an Excel spreadsheet to a web \
> browser. This is working great!
> But, I cannot find a way to easily expland each column's width to accomodate the \
> widest cell in the column (ie. Fit the contents). That is, i'd like to have the \
> Excel spreadsheet initially open as if the user double-clicked the boundary to the \
> right of each column heading.
> Anyone know of a way to do this programatically?
>
> thanks,
> -john
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List: http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic