poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yegor Kozlov <yegor.koz...@dinom.ru>
Subject Re: Problem creating an .xlsx file using POI and XSSF
Date Thu, 23 Jun 2011 10:51:56 GMT
Fixed in r1138819

I fixed workbook.createSheetName(sheetName) to silently truncate the input
argument if it is longer than 31 character.

The idea to throw IllegalArgumentException is not very good. My concern is
existing usages of POI in production. With version of POI prior to 3.8 existing
code swallowed long sheet names without any exceptions. If we decided to throw
IllegalArgumentException then these system would start to fail which is not
good.

Truncating the input argument to 31 character seems a reasonable workaround.

Yegor


On Wed, Jun 22, 2011 at 4:04 PM, Yegor Kozlov <yegor.kozlov@dinom.ru> wrote:
> 2007 works for me, but the behavior may depend on Excel update number
> or service pack.
>
> OK, I'm convinced to revert my changes. The fix is coming soon. I
> created a new Bugzilla ticket to track progress:
>
> https://issues.apache.org/bugzilla/show_bug.cgi?id=51415
>
> Yegor
>
> On Wed, Jun 22, 2011 at 3:09 PM, snelligan <snelliga@illinois.edu> wrote:
>> Attached is a problem which shows the 31 character problem.
>>
>>
>>
>> We are running Excel 2007 and having the problem.
>>
>>
>>
>> -Steve Nelligan
>>
>>
>>
>>
>>
>> Steven M. Nelligan
>>
>>
>>
>> From: Yegor Kozlov-4 [via Apache POI]
>> [mailto:ml-node+4513283-449273712-221743@n5.nabble.com]
>> Sent: Wednesday, June 22, 2011 3:11 AM
>> To: Nelligan, Steve M (Facilities & Services)
>> Subject: Re: Problem creating an .xlsx file using POI and XSSF
>>
>>
>>
>> On Tue, Jun 21, 2011 at 9:50 PM, Jon Svede <[hidden email]> wrote:
>>> The javdoc spells out that limitation but I agree with you, I think it
>> should
>>> throw an exception.
>>>
>> Not exactly, the rule is more complex.
>>
>> Non Excel clients such as OpenOffice allow opening / editing of
>> worksheets with names longer than 31 characters.
>>
>> Some time back I loosened the 31 characters constraint to support
>> that. That seemed to be OK for Excel 2003, Excel 2007 and OpenOffice.
>> They all were able to open workbooks with long sheet names. Now I'm
>> testing in Excel 2010 and it fails to open .xlsx.
>>
>> The test synopsis is below:
>>
>> XLS format:
>>
>> [OK] Excel 2003 can open .xls files  with long sheet names without
>> error or warning. The sheet tab shows the full name.
>> [OK] Excel 2007 can open .xls files  with long sheet names without
>> error or warning. The sheet name is silently truncated to 31
>> characters.
>> [OK] Excel 2010 can open .xls files  with long sheet names without
>> error or warning. The sheet name is silently truncated to 31
>> characters.
>>
>> XLSX format:
>>
>> [OK] Excel 2007 can open .xls files  with long sheet names without
>> error or warning. The sheet name is silently truncated to 31
>> characters.
>> [FAILURE] Excel 2010 failes to open .xlsx files  with sheet names
>> longer than 31 characters.
>>
>> I'm inclined to revert my previous change and always enforce the 31
>> characters rule. The question is what to do if the sheetName argument
>> is long? Throw IllegalArgumentException or silently truncate to 31
>> chars?
>>
>> Yegor
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>
>>
>>
>> ________________________________
>>
>> If you reply to this email, your message will be added to the discussion
>> below:
>>
>> http://apache-poi.1045710.n5.nabble.com/Problem-creating-an-xlsx-file-us
>> ing-POI-and-XSSF-tp4506461p4513283.html
>>
>> To unsubscribe from Problem creating an .xlsx file using POI and XSSF,
>> click here
>> <http://apache-poi.1045710.n5.nabble.com/template/NamlServlet.jtp?macro=
>> unsubscribe_by_code&node=4506461&code=c25lbGxpZ2FAaWxsaW5vaXMuZWR1fDQ1MD
>> Y0NjF8MjYyNDY3NjE4> .
>>
>>
>>
>> --
>> View this message in context: http://apache-poi.1045710.n5.nabble.com/Problem-creating-an-xlsx-file-using-POI-and-XSSF-tp4506461p4513669.html
>> Sent from the POI - User mailing list archive at Nabble.com.
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Mime
View raw message