Bug 45164 - can't add data validation to excel writen by ms excel 2003
Summary: can't add data validation to excel writen by ms excel 2003
Status: RESOLVED WORKSFORME
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 3.0-FINAL
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-06-08 21:04 UTC by rongfu
Modified: 2013-08-05 09:10 UTC (History)
2 users (show)



Attachments
The main class (1.08 KB, application/octet-stream)
2008-06-25 02:10 UTC, Schelfhout Dries
Details
The class with the actual code (2.10 KB, application/octet-stream)
2008-06-25 02:12 UTC, Schelfhout Dries
Details
Templates four (13.00 KB, application/vnd.ms-excel)
2008-06-25 02:13 UTC, Schelfhout Dries
Details
Template one (18.50 KB, application/vnd.ms-excel)
2008-06-25 02:15 UTC, Schelfhout Dries
Details

Note You need to log in before you can comment on or make changes to this bug.
Description rongfu 2008-06-08 21:04:11 UTC
If open a excel created by excel 2003 with poi, addDataValidation will effect nothing.
Comment 1 Josh Micich 2008-06-20 01:19:04 UTC
From what I understand, you created a workbook in Excel 2003, and opened it in POI, then added data validation (by calling HSSFSheet.addValidationData(HSSFDataValidation) etc), and saved.  Then when re-opening in Excel, no changes were apparent.

Is this correct?

It's hard to tell what is going wrong so far, bug it might be worth trying out a recent build, just in case this is a bug which has recently been fixed.  If not, please upload the offending (input) spreadsheet and some sample java code to produce this bug.
Comment 2 Schelfhout Dries 2008-06-25 02:10:09 UTC
Created attachment 22171 [details]
The main class
Comment 3 Schelfhout Dries 2008-06-25 02:12:17 UTC
Created attachment 22172 [details]
The class with the actual code

To swap between the two templates just change the name of the inputstream.
Also the directory where you place the templates needs to be changed.
Comment 4 Schelfhout Dries 2008-06-25 02:13:00 UTC
Created attachment 22173 [details]
Templates four

This template is just an empty excel with one sheet.
Comment 5 Schelfhout Dries 2008-06-25 02:15:33 UTC
Created attachment 22174 [details]
Template one

The template has some other info in it.
This template gives the follow excel error log after running the code on it :

-----------------------------
Microsoft Excel File Repair Log

Errors were detected in file 'C:\javadev\tools\eclipse-3.3\workspace\ProcExcell\etc\output\procfour.xls'
The following is a list of repairs:

Damage to the file was so extensive that repairs were not possible. Excel attempted to recover your formulas and values, but some data may have been lost or corrupted.
--------------------------

Not mutch usefull info from microsoft :)
Comment 6 Schelfhout Dries 2008-06-25 02:30:43 UTC
I have the same problem as you discribe.

So I went and created the a small example code to show that I had this problem also.
But when I created the simpel example(template four) and launched it, it worked.
But when I did the same thing with an other excel(template one) it seemed to give an error(see comment attachments).
I'm not getting this error if there's already a validation in the excell.
But when you open the file the validations I tried to add are not there and the validation that was in the template is also gone.
The 'template one' that I uploaded here, is without a validation thus with the error. 
You can add a validation manuel to see what I just told here.

Why it works in 'template four' and not in 'template one' I don't know.

Maybe with my files you can find out what goes wrong.
Comment 7 David Fisher 2009-02-18 12:44:20 UTC
Try the latest POI 3.5-beta5
Comment 8 Dominik Stadler 2013-08-05 09:10:42 UTC
no response in a long time => resolving for now, please reopen with more information ifnthis is still an issue