[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
[ic] XLS import failure - 255 character limit issue.
> I have seen problems with XLS created by Excel 97 with long fields. They
> are fine if generated by Gnumeric...
>
>
This is a good thing that someone has seen this :)
>>Now I've tested my install of Spreadsheet::ParseExcel and it reads the
>>long descriptions fine. I'm not sure what else I can do to aid in this
>>matter.
>
>
> What code are you using to verify that? We would need to compare
> how it is done with the way IC does it.
>
> for( ; $iR <= $oWkS->{MaxRow}; $iR++) {
> my $row = $oWkS->{Cells}[$iR];
> @out = ();
> for($iC = $mincol; $iC <= $maxcol; $iC++) {
> if(! defined $row->[$iC]) {
> push @out, "";
> next;
> }
> push @out, $row->[$iC]->Value;
> }
> $sheets->{$sname} .= join "\t", @out;
> $sheets->{$sname} .= "\n";
> }
>
> That is the loop that actually does the read. If there are embedded
> newlines or TABs it might cause a problem...we could add some
> translation stuff, I suppose. You might change this in import_fields:
>
> push @out, $row->[$iC]->Value;
>
> to;
>
> my $v = $row->[$iC]->Value;
> $v =~ tr/\n\t/\r /;
> push @out, $v;
>
> That will kill any tabs, of course, but will prevent import problems.
>
This would be fine since I don't care for TABs in HTML anyway. But I
don't see any TABs in the particular Excel file.
Here's the code I borrowed from ParseExcel example scripts to test my
Excel file.
--snip--
my $oBook = $oExcel->Parse('test.xls');
PrnBook($oBook);
sub PrnBook($)
{
my($oBook) = @_;
my($iR, $iC, $oWkS, $oWkC);
print "=========================================\n";
print "FILE :", $oBook->{File} , "\n";
print "COUNT :", $oBook->{SheetCount} , "\n";
print "AUTHOR:", $oBook->{Author} , "\n";
for(my $iSheet=0; $iSheet < $oBook->{SheetCount} ; $iSheet++) {
$oWkS = $oBook->{Worksheet}[$iSheet];
print "--------- SHEET:", $oWkS->{Name}, "\n";
for(my $iR = $oWkS->{MinRow} ;
defined $oWkS->{MaxRow} && $iR <= $oWkS->{MaxRow} ;
$iR++) {
for(my $iC = $oWkS->{MinCol} ;
defined $oWkS->{MaxCol} && $iC <=
$oWkS->{MaxCol} ; $iC++) {
$oWkC = $oWkS->{Cells}[$iR][$iC];
print "( $iR , $iC ) =>", $oWkC->Value, "\n" if($oWkC);
}
}
}
}
--snip--
The variable naming is wicked and causes my eyes to hurt so it's hard
for me to understand what is happening here.
-reid