This queue is for tickets about the Spreadsheet-WriteExcel CPAN distribution.
Maintainer(s)' notes
If you are reporting a bug in Spreadsheet::WriteExcel here are some pointers
1) State the issues as clearly and as concisely as possible. A simple program or Excel test file (see below) will often explain the issue better than a lot of text.
2) Provide information on your system, version of perl and module versions. The following program will generate everything that is required. Put this information in your bug report.
#!/usr/bin/perl -w
print "\n Perl version : $]";
print "\n OS name : $^O";
print "\n Module versions: (not all are required)\n";
my @modules = qw(
Spreadsheet::WriteExcel
Parse::RecDescent
File::Temp
OLE::Storage_Lite
IO::Stringy
Spreadsheet::ParseExcel
Scalar::Util
Unicode::Map
);
for my $module (@modules) {
my $version;
eval "require $module";
if (not $@) {
$version = $module->VERSION;
$version = '(unknown)' if not defined $version;
}
else {
$version = '(not installed)';
}
printf "%21s%-24s\t%s\n", "", $module, $version;
}
__END__
3) Upgrade to the latest version of Spreadsheet::WriteExcel (or at least test on a system with an upgraded version). The issue you are reporting may already have been fixed.
4) Create a small but complete example program that demonstrates your problem. The program should be as small as possible. At the same time it should be a complete program that generates an Excel file. If the Spreadsheet::WriteExcel section is part of a much larger program then simplify it down to the essentials. Simulate any DB reads with an array.
5) Say if you tested with Excel, OpenOffice, Gnumeric or something else. Say which version of that application you used.
6) If you are submitting a patch you should check with the author whether the issue has already been patched or if a fix is in the works. Patches should be accompanied by test cases.
Asking a question
If you would like to ask a more general question there is the Spreadsheet::WriteExcel Google Group.
Owner: |
jmcnamara [...] cpan.org
|
Requestors: |
sean [...] seanoneill.info
|
Cc: |
|
AdminCc: |
|
|
Severity: |
Normal |
Broken in: |
0.37 |
Fixed in: |
(no value)
|
|
Sat Aug 10 00:45:28 2002
Guest - Ticket created
While not "runable", the following code shows the merging of cells on a specific row between columns 1 through 4.
foreach $TEMPVAR ( @{ $SYSCONFIG->{$HOSTNAME}{'prom'} } ) {
$HOST_WRK_SHEET->merge_cells($ACTIVE_ROW, 1, $ACTIVE_ROW, 4);
$HOST_WRK_SHEET->write( $ACTIVE_ROW, 1, $TEMPVAR, $DATA_M_FORMAT_NW );
$HOST_WRK_SHEET->write_blank( $ACTIVE_ROW, 2, $DATA_M_FORMAT_NW );
$HOST_WRK_SHEET->write_blank( $ACTIVE_ROW, 3, $DATA_M_FORMAT_NW );
$HOST_WRK_SHEET->write_blank( $ACTIVE_ROW++, 4, $DATA_M_FORMAT_NW );
}
When bringing up the spreadsheet, the cells do show up as "merged" e.g. when selected all four cells show up as one contiguous box.
But the text within the box is "centered". The format variable $DATA_M_FORMAT_NW has the horizontal align element "left" so the text should be left justified.
I can "fix" left justification manually by:
- selecting merged cells
- press left justify toolbar button (oddly, this temporarily "breaks" the merged cell attributes and all four cells are once again individually selectable)
- pressing CNTL-Z (undo)
- press left justify toolbar button to activate left justify
- then pressing left justify toolbar button to unactivate left justify
The last two steps "reapplies/fixes" the merge cell attributes so that all four cells once again show up as one contiguous box when selected. The merge3.pl example script shows this exact same behavior.
I'm using Spreadsheet::WriteExcel 0.37 on Solaris 8, Perl 5.005_03, and Excel 2000 on Windows 2000 Pro.
Sun Aug 11 19:00:37 2002
jmcnamara [...] cpan.org - Taken
Mon Aug 12 11:37:56 2002
jmcnamara [...] cpan.org - Status changed from 'new' to 'resolved'
In order to obtain this type of formatting the merge_cells() method must be called after the cells have been written.
The merge3.pl example is misleading/wrong in this repect. Try something like the following instead:
#!/usr/bin/perl -w
use strict;
use Spreadsheet::WriteExcel;
# Create a new workbook and add a worksheet
my $workbook = Spreadsheet::WriteExcel->new('reload.xls');
my $worksheet = $workbook->addworksheet();
# Highlight the formatting.
$worksheet->set_row($_, 30) for (1..11);
$worksheet->set_column('B:D', 20);
my $format2 = $workbook->addformat(
border => 6,
bold => 1,
color => 'red',
valign => 'top',
align => 'left',
);
$worksheet->write('B5', 'Aligned to the top and left', $format2);
$worksheet->write_blank('C5', $format2);
$worksheet->write_blank('D5', $format2);
$worksheet->write_blank('B6', $format2);
$worksheet->write_blank('C6', $format2);
$worksheet->write_blank('D6', $format2);
$worksheet->merge_cells('B5:D6');
The documentation and examples in relation to merge_cells() will be updated and extended in the next release.
John.
--