[ic] More problems with Spreadsheet Export

interchange-users@interchange.redhat.com interchange-users@interchange.redhat.com
Fri Dec 21 13:25:01 2001


> Quoting From: cfm@maine.com [mailto:cfm@maine.com]
> 
> On Fri, Dec 21, 2001 at 12:15:53PM -0500, Mike Heins wrote:
> > Quoting cfm@maine.com (cfm@maine.com):
> 
> > > > > > This is true of Excel '95, but not of '97 and 
> above. I have actually
> > > > > > tested spreadsheet import and export of text fields 
> greater than
> > > > > > 256 characters on Excel 2000 and '97.
> ...
> > > I missed the start of this.
> > > 
> > > The DBI modules (parse and write spreadsheet AFAICR) have a 256
> > > char limit in them for excel.  DBD::Excel calls them, so it has
> > > the same limit.  You need to hack the pm to raise the limit, at
> > > least on write.  That's next to impossible to maintain if you
> > > are using a package manager (eg rpm or deb).
> > > 
> > > The amount of data one can enter and save into an excel field in 
> > > one recent version appears to be about 15362 chars.  Might be 
> > > version specific.
> > > 
> > > At any rate, counting on more than 256 when the perl modules don't
> > > provide more is asking for trouble.  The data is silently 
> truncated.
> > 
> > This is not true. I cannot characterize all versions of 
> Excel (and Gnumeric),
> > but the import/export works fine with the ones I mentioned 
> at arbitrary
> > sizes. I provided a few options, and make the proper tweaks in the
> > objects at the time of import or export.
> > 
> > Neither uses DBD::Excel.  <------   That's the ticket, I 
> stand corrected.
> 
> For future reference, someone using DBD::Excel or Spreadsheet perl
> modules to access same files will run into issues here:
> 
> From Spreadsheet::WriteExcel.pm:
> =item * Move to Excel97/2000 format as standard. This will allow 
> strings greater than 255 characters and hope fully Unicode. The 
> Excel 5 format will be optional. This will be in the next major 
> release of the module. All other features are on hold.
> 
> This is limit it package Spreadsheet::WriteExcel::Worksheet.pm:
>     my $rowmax                  = 65536; # cfm change from 
> 16384 in Excel 5

The line I find more interesting is two below that line:

    my $strmax                  = 255;

Makes me think that Worksheet.pm has 255 as the max length of the
contents of any given cell.  It uses this value in the code below:

    if ($strlen > $self->{_xls_strmax}) { # LABEL must be < 255 chars
        $str       = substr($str, 0, $self->{_xls_strmax});
        $length    = 0x0008 + $self->{_xls_strmax};
        $strlen    = $self->{_xls_strmax};
        $str_error = -3;
    }

I'm a bit confused, though because it says the LABEL can't be more
than 255 chars, which I would consider different than if the comment
said that the CONTENT must be < 255 chars.

It's truncating something to 255 char, I'm just not sure what.

Patrick