Thanks... this should come in usefull one day. Regards, Daniel
-----Original Message----- From: Walker, Donald [mailto:[EMAIL PROTECTED] Sent: Thursday, 01 April, 2004 5:24 PM To: 'POI Users List' Subject: RE: Autosizing columns It appears that the answer is that there is no answer - it is not possible in a general way. However, since the latest versions of POI support macros, I have a workaround. When you use POI to create a new file from scratch, you can do the following: Create a new file within Excel. Record a macro named 'Auto_open'. The contents of the macro should be: Cells.EntireColumn.AutoFit. i.e. Sub Auto_open() Cells.EntireColumn.AutoFit End Sub Save the file off somewhere accesible to your application. Whenever you need to create a new Excel file - open this template instead, using the HSSFWorkbook(InputStream inputStream) constructor. The downside is that the columns will be resized everytime the sheet is opened. Workarounds for this would either be to set a flag saying that it had been done and shouldn't be done again, or perhaps to delete the macro itself. Hope this helps Donald. -----Original Message----- From: Daniel Joshua [mailto:[EMAIL PROTECTED] Sent: Thursday, April 01, 2004 4:10 AM To: 'POI Users List' Subject: RE: Autosizing columns by the way, what was the answer? Regards, Daniel -----Original Message----- From: Walker, Donald [mailto:[EMAIL PROTECTED] Sent: Wednesday, 31 March, 2004 8:33 PM To: '[EMAIL PROTECTED]' Subject: RE: Autosizing columns Please ignore this question - I see that there are many similar questions in the archive. Thanks. > -----Original Message----- > From: Walker, D > Sent: Wednesday, March 31, 2004 12:55 PM > To: '[EMAIL PROTECTED]' > Subject: Autosizing columns > > Is there an easy way to automatically resize all columns to fit their > contents in a POI generated excel file? > > In Excel, the affect can be achieved by executing: > Cells.EntireColumn.AutoFit Or by selecting all data in a sheet and > then doubling clicking on the line dividing columns A & B. > > Thanks > Donald. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
