Subject: | File created in UNIX crashes Excel |
I am trying to create spreadsheet from data extracted from MySQL 3.23.
The script is running on SunOS corsair 5.6 Generic_105181-29 sun4u sparc SUNW,Ultra-Enterprise.
When opening file in Excel XP (2003) or Excel 2000, the following behavior occurs:
First appearance of text in column A, and column Q (last column written) is not shown.
Attempts to resize any column or otherwise format the cell to make the text appear, causes Excel to crash and send error report.
Upon restarting and repairing the original file, all text is seen and no actions cause Excel to crash.
Code snippet as follows:
my $workbook = Spreadsheet::WriteExcel->new("TNECPC04-CTR1.xls");
$sheet1 = $workbook->add_worksheet("NE CPC TOTAL");
$format1 = $workbook->add_format();
$format1->set_bold();
$format1->set_align('center');
$format1->set_valign('vcenter');
$format2 = $workbook->add_format();
$format2->set_bg_color('red');
$format3 = $workbook->add_format();
$format3->set_bold();
$format3->set_align('center');
$format3->set_valign('center');
$format3->set_italic();
$format3->set_size('8');
$format4 = $workbook->add_format();
$format4->set_align('left');
$format4->set_italic();
$format4->set_size('8');
$fnum1 = $workbook->add_format();
$fnum1->set_num_format('#,##0');
$fnum2 = $workbook->add_format();
$fnum2->set_num_format('0.00%');
$sheet1->set_column('A:A', 20);
$sheet1->set_column('Q:Q', 10);
$sheet1->merge_range('A1:Q1', 'Main Title', $format1);
$sheet1->merge_range('A2:Q2', 'SubTitle', $format1);
$sheet1->merge_range('A3:Q3', 'SubTitle', $format1);
$sheet1->merge_range('A4:Q4', "$mon, $year", $format1);
$sheet1->merge_range('A5:Q5', ' ', $format1);
$sheet1->write_blank('A6', undef);
$sheet1->write('B6', 'MESSAGE', $format1);#this text sporadically appears
$sheet1->merge_range('C6:G6', 'DSO\'s', $format1);
$sheet1->write('H6', 'HI-CAP', $format1);
$sheet1->merge_range('I6:K6', 'CARRIER', $format1);
$sheet1->merge_range('L6:P6', 'OTHER TIRKS PROVISIONING', $format1);
$sheet1->write('Q6', 'TOTAL', $format1);#this text does not appear
$sheet1->write('A7', 'TOTAL MONTH', $format1);#this text does not appear
$sheet1->write_blank('B7', $format1);
$sheet1->write('C7', 'Analog', $format3);
$sheet1->write('D7', 'Digital', $format3);
$sheet1->write('E7', 'Loc. Spec.', $format3);
$sheet1->write('F7', 'Comp. Ckts.', $format3);
$sheet1->write('G7', 'Total', $format3);
$sheet1->write_blank('H7', $format3);
$sheet1->write('I7', 'Customer', $format3);
$sheet1->write('J7', 'Infra.', $format3);
$sheet1->write('K7', 'Total', $format3);
$sheet1->write('L7', 'Cables', $format3);
$sheet1->write_string('M7', 'Power/Pulse', $format3);
$sheet1->write('N7', 'Routing', $format3);
$sheet1->write('O7', 'Spans', $format3);
$sheet1->write('P7', 'Total', $format3);
$sheet1->write_blank('Q7', $format3);
$sheet1->set_row(7, 5);
$sheet1->merge_range('A8:Q8', ' ', $format2);
#row 9
$sheet1->write('A9', 'Orders RID Total', $format4);
$sheet1->write('B9', "$messagetotal", $fnum1);
$sheet1->write('C9', "$dsoanatotal", $fnum1);
$sheet1->write('D9', "$dsodigtotal", $fnum1);
$sheet1->write('E9', "$dsolstotal", $fnum1);
$sheet1->write('F9', "$dsocctotal", $fnum1);
$sheet1->write('G9', "$dsototal", $fnum1);
$sheet1->write('H9', "$hicaptotal", $fnum1);
$sheet1->write('I9', "$carriercustotal", $fnum1);
$sheet1->write('J9', "$carrierinfratotal", $fnum1);
$sheet1->write('K9', "$carriertotal", $fnum1);
$sheet1->write('L9', "$cablestotal", $fnum1);
$sheet1->write('M9', "$pptotal", $fnum1);
$sheet1->write('N9', "$routingtotal", $fnum1);
$sheet1->write('O9', "$spanstotal", $fnum1);
$sheet1->write('P9', '=SUM(L9:O9)', $fnum1);
$sheet1->write('Q9', '=SUM(B9,G9,H9,K9,P9)', $fnum1);
.... more of same code....
$sheet1->activate();
$sheet1->select();
$workbook->close();
Thank you for any help or suggestions you may provide.
Marianne
Message body not shown because it is not plain text.