× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



There is a HSSFSheet.autoSizeColumn(Short column), but it only works in a
GUI environment. So, the way you are doing it is the only way.

I would probably create a simple calculateColWidth(int) procedure just to
keep a standard.

James R. Perkins
http://twitter.com/the_jamezp


On Thu, Aug 13, 2009 at 19:58, Erick Garske <egarske@xxxxxxxxxxxxx> wrote:


In the code example below, (b) my widths ( intWidth ) corresponds with the
maximum character width. But when I open the spread sheet and select a
field that was formatted with a style below (a) the field is maxed out to
256. My numeric fields, are just fine as I use the
technic below (c). Isn't there an attribute on the sheet that can be set
to enable autosize to work for all columns to accomodate users wishing to
manully resize a column without that column expanding to the width of their
screen? Do I need to create a data format for all the text fields similar to
what I did for the numeric fields?

Thanks,
Erick


(a) styNormal =
HSSFWorkbook_createCellStyle(book); HSSFCellStyle_setAlignment(styNormal:
ALIGN_LEFT);


(b)
IfintRow = 0;
HSSFSheet_SetColumnWidth( sheet : intCol : intWidth * 256 );
HSSFSheet_autoSizeColumn(sheet : intWidth );


(c)/ styNumeric0 = HSSFWorkbook_createCellStyle(book);/ DataFmt =
HSSFWorkbook_createDataFormat(book);/ Str0 = new_String('#,##0');/ NumFmt =
HSSFDataFormat_getFormat(DataFmt: Str0);/
HSSFCellStyle_setDataFormat(styNumeric0: NumFmt);/
HSSFCellStyle_setAlignment(styNumeric0: ALIGN_RIGHT);
EndIf;I am attempting to format my colums so that that they will not
only display the cells in a presentable way, but also so that if an attempt
is made to manully autosize a column by a user that column will then size to
the maxium width of the widest value.
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.