Victor,

The docs at 
http://ostermiller.org/utils/doc/com/Ostermiller/util/ExcelCSVParser.html
explicitly state that the parser should work as you expect:

<quote>
Empty fields are returned as as String of length zero: "". The
following line has three empty fields and three non-empty fields in
it. There is an empty field on each end, and one in the middle. One
token is returned as a space.

,second,, ,fifth,
</quote>

A few things I might try if I were you:
1) try and reproduce the problem with as simple an example as possible
(e.g. Parser.parse("a,,b") )
2) write some simple java to try to reporoduce a simple example
3) if both of the above still reproduce the broblem, you could ask mr.
ostermiller to fix the problem and maybe you can workaround it by
using a regex on the empty string to add a "rare" string to empty
cells prior to parsing and then remove it after parsing
4) if you can't reproduce the problem with a simple string, keep
adding to it until it looks more like your CSV and fails.

Good luck. Sorry I couldn't be of more help.  I'd be interested to
hear what you find.
Jon

On Apr 4, 2005 6:10 PM, Victor Moore <[EMAIL PROTECTED]> wrote:
> Hi Jon,
> I'm happy with this utility , except this little problem.
> Bellow is the code:
> 
> <cfscript>
>     parser = createObject("java", "com.Ostermiller.util.ExcelCSVParser") ;
>     fileInfo = parser.parse(fileContents) ;
>     noFields = arrayLen (fileInfo);
> for (i = 2; i lte noFields; i = i + 1)
> {
> lineArray = fileInfo [i];
>       initSize = arrayLen (lineArray);
>    if (initSize lt 30)
>                      {
> msg = "Error...;
>                      }
> }
> </cfscript>
> 
> I know that there are 30 fields in the file. If I open the file in
> Excel I can see all of them there, but some of them have no value and
> this is why the checking bombs.
> If I run a replace all in excel and replace the empty fields with a
> space everything is OK and the file parsing works as expected.
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:201816
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to