I have used Spreadsheet::WriteExcel for creating spreadsheet report.
I tried to merge some cells using merge_range() function.
$worksheet->merge_range(3,5,9,4,$title, $format); [OR]
$worksheet->merge_range('E3:I4',$title, $format);
$worksheet->write('F6',"LANGUAGE",$format);
it shows the error me开发者_如何学Pythonssage like the following
Error: refer to merge_range() in the documentation. Can't use previously merged format in non-merged cell
How to solve this. if I used write()
.. that time only it shows the error. if I didn't used any write functions that time the above error message is not showing and the cells are merged.
If you see the documentation of Spreadsheet::WriteExcel module, it states :
WARNING: The format object that is used with a merge_range() method call is marked internally as being associated with a merged range. It is a fatal error to use a merged format in a non-merged cell. Instead you should use separate formats for merged and non-merged cells. This restriction will be removed in a future release.
That means do not use format '$format' as used in the
$worksheet->write('F6',"LANGUAGE",$format);
Make two format one for merged cell other for non-merged cell.
Problem will be solved.
精彩评论