1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
Description: Handle BIFF8 UTF16 strings in the 'RSTRING' opcode too, just
like 'STRING'.
Bug-Debian: https://bugs.debian.org/299870
Forwarded: https://rt.cpan.org/Public/Bug/Display.html?id=16786
Author: Niko Tyni <ntyni@iki.fi>
Reviewed-by: gregor herrmann <gregoa@debian.org>
Last-Update: 2011-04-24
--- a/lib/Spreadsheet/ParseExcel.pm
+++ b/lib/Spreadsheet/ParseExcel.pm
@@ -898,10 +898,23 @@
my ( $oBook, $bOp, $bLen, $sWk ) = @_;
my ( $iR, $iC, $iF, $iL, $sTxt );
( $iR, $iC, $iF, $iL ) = unpack( "v4", $sWk );
- $sTxt = substr( $sWk, 8, $iL );
+ my $bver = $oBook->{BIFFVersion};
+ my ( $rich, $sCode );
+ if ( $bver == verBIFF8 ) {
+ my ( $raBuff, @rest ) =
+ _convBIFF8String( $oBook, substr( $sWk, 6 ), 1 );
+ $sTxt = $raBuff->[0];
+ $sCode = ( $raBuff->[1] ) ? 'ucs2' : undef;
+ $rich = $raBuff->[2];
+ }
+ else {
+ $sTxt = substr( $sWk, 8, $iL );
+ $sCode = '_native_';
+ $rich = substr( $sWk, ( 8 + $iL ) + 1 )
+ if ( length($sWk) > ( 8 + $iL ) );
+ }
- #Has STRUN
- if ( length( $sWk ) > ( 8 + $iL ) ) {
+ if ($rich) {
_NewCell(
$oBook, $iR, $iC,
Kind => 'RString',
@@ -909,9 +922,9 @@
FormatNo => $iF,
Format => $oBook->{Format}[$iF],
Numeric => 0,
- Code => '_native_', #undef,
+ Code => $sCode,
Book => $oBook,
- Rich => substr( $sWk, ( 8 + $iL ) + 1 ),
+ Rich => $rich,
);
}
else {
@@ -922,7 +935,7 @@
FormatNo => $iF,
Format => $oBook->{Format}[$iF],
Numeric => 0,
- Code => '_native_',
+ Code => $sCode,
Book => $oBook,
);
}
|