Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Strange behaviour (Spreadsheet::WriteExcell)

by jmcnamara (Monsignor)
on Feb 28, 2005 at 11:09 UTC ( [id://435016]=note: print w/replies, xml ) Need Help??


in reply to Strange behaviour (Spreadsheet::WriteExcell)


There doesn't seem to be anything wrong in the code that you have shown.

However it is hard to tell from just this code. It would be better if you could post a fully working example that demonstrates the problem. Use the bug_report program in the standard Spreadsheet::WriteExcel distro as an example.

The main reasons that an Spreadsheet::WriteExcel file will fail to load in Excel are:

  • The file was corrupted in the transfer to a Windows system. Check if the excel file on the generating system is the same size as the file on the target system.
  • The Spreadsheet::WriteExcel file was corrupted by UTF8 data (sometimes happens in conjunction when extracting data from a XML file with Perl 5.6).
  • A merge format was used in a non-merged cell.

--
John.

  • Comment on Re: Strange behaviour (Spreadsheet::WriteExcell)

Replies are listed 'Best First'.
Re^2: Strange behaviour (Spreadsheet::WriteExcell)
by hawtin (Prior) on Feb 28, 2005 at 11:36 UTC

    Unfortunately the script is too big (and commercially sensitive) to easily produce a publishable version. As you can see from my comments I don't have enough of an understanding of the problem to be able to submit a bug report that would be of much help.

    The data being output did originate in an XML file, and the script is running here under 5.6, so your second suggestion looks like a good candidate. As I said I suspect some kind of utf8 type issue but I cannot see anything that looks wrong.

    Anyway I have found a fix, in my original code just before the write_string() I have inserted:

    if(length($val) > 100) { # For some reason we have to duplicate # the contents of the string via a process # that detaches from the original variable # if the string is longer than 136 characters # (I don't know why) my $t = pack("c".length($val), unpack("c".length($val),$val)); $val = $t; }

    Now it all seems to work :-O


      Yes, if that code fixes the problem then it is definitely a UTF8 issue. The Spreadsheet::WriteExcel docs also suggest the following workaround in the section Working with XML:
      $new_str = pack 'C*', unpack 'U*', $utf8_str;

      --
      John.

      > the script is running here under 5.6

      Perhaps you could update to a modern version of Perl? There are many many utf8 bugs and problems fixed in the meantime.

        In this case it is running under 5.6 on Windows, elsewhere it is under 5.8 on Solaris. For various reasons I can't upgrade the Windows installation.

        Mind you for me 5.6 is a modern version, I have some customers that are still running Perl 4 scripts I wrote in 1993 :-(

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://435016]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (6)
As of 2024-04-20 00:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found