Bug 45876 - Support optional validationskipping of maximum sheet name constraint
Summary: Support optional validationskipping of maximum sheet name constraint
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 3.5-dev
Hardware: PC Windows XP
: P2 enhancement (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2008-09-24 06:44 UTC by Stevo Slavic
Modified: 2008-09-29 15:13 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Stevo Slavic 2008-09-24 06:44:35 UTC
Please support optional skipping of maximum (work)sheet name validation, currently implemented in "validateSheetName(String sheetName)", static method of org.apache.poi.hssf.record.BoundSheetRecord class. By default, implementation can and should validate, but optional skipping (through parameters, ...) would be very handy in specific scenarios, such as following one.

Worksheet name longer than 30 chars can not be created in MS Office, but it can be read and all more than 30 chars get displayed well, with exception that MS Office does not allow editing of such worksheet name, not even to shorten it. Nevertheless, OpenOffice can open such worksheets with worksheet name editable, to be or if already longer than 30 chars. I'm mentioning this because of the use case where it would be handy to have POI allow validation skipping of maximum sheet name constraint. DBUnit, popular extension of JUnit, Java unit testing framework, provides out-of-the-box support for using MS Excel files as test data sets. For each test class one can create corresponding XLS file to be used as test data set. In that XLS file, each worksheet corresponds to single table in the database, and worksheet name corresponds to table name. As table names can be longer than 30 chars, and because POI can be used to generate XLS files used by DBUnit tests, it would be handy if POI would support worksheets with name longer than 30 chars. As said earlier, such XLS files can be modified/maintained using OpenOffice even though they have name of more than "MS standard" maximum worksheet name length.
Comment 1 Josh Micich 2008-09-29 15:13:36 UTC
Fixed in svn 700280.

It was too cumbersome to overload all related methods with optional validation flags, so I just disabled the upper bounds check for all cases.  

Excel (2007) opens files with long sheet names without error or warning.  However, long sheet names are silently truncated to 31 chars.  In order to avoid funny duplicate sheet name errors, I changed POI's name check to enforce uniqueness on only the first 31 chars.