in reply to Spreadsheet::WriteExcel crashing Excel97


There is a only one Excel crashing problem that I'm aware of. This occurs when you use the merge_cells() method without specifying a format for the entire range of cells. This only affects Excel97 and not Excel2000.

The solution is to ensure that you write a formatted blank to other cells in the merged range as follow:

#!/usr/bin/perl -w use strict; use Spreadsheet::WriteExcel; my $workbook = Spreadsheet::WriteExcel->new('test.xls'); my $worksheet = $workbook->addworksheet(); $worksheet->set_row($_, 30) for (1..11); $worksheet->set_column('B:D', 20); my $format = $workbook->addformat( border => 6, bold => 1, color => 'red', valign => 'vcenter', align => 'center', ); $worksheet->write('B2', 'Some text here', $format); $worksheet->write_blank('C2', $format); $worksheet->write_blank('D2', $format); $worksheet->write_blank('B3', $format); $worksheet->write_blank('C3', $format); $worksheet->write_blank('D3', $format); $worksheet->merge_cells('B2:D3');

If this doesn't fix your problem then send me an email.

--
John.

Replies are listed 'Best First'.
Re: Re: Spreadsheet::WriteExcel crashing Excel97
by Anonymous Monk on Aug 27, 2002 at 01:19 UTC
    John,

    That certainly sounds like a strong possibility in our situation. I will have the code reviewed for systematic formatting for the entire range of merged cells.

    Thanks for your help. In case it's of any use to you, I'll let you know at your email what we find.

    Bob