summaryrefslogtreecommitdiffstats
path: root/lib/Spreadsheet/Template
diff options
context:
space:
mode:
authorJason <jason@socialflow.com>2013-08-28 15:49:12 +0000
committerJason <jason@socialflow.com>2013-08-28 15:49:12 +0000
commit2bf66a5ae431e3072e4e890dc2324fe0af612d61 (patch)
tree3a75f777cae77d7d3f4d29498e9ae25d37061cfc /lib/Spreadsheet/Template
parent3566bcd52ef96d25f8c8f695e0f43e768b315c16 (diff)
downloadspreadsheet-template-2bf66a5ae431e3072e4e890dc2324fe0af612d61.tar.gz
spreadsheet-template-2bf66a5ae431e3072e4e890dc2324fe0af612d61.zip
use row and column numbers instead of range for merge function
Diffstat (limited to 'lib/Spreadsheet/Template')
-rw-r--r--lib/Spreadsheet/Template/Helpers/Xslate.pm16
-rw-r--r--lib/Spreadsheet/Template/Processor/Xslate.pm6
-rw-r--r--lib/Spreadsheet/Template/Writer/Excel.pm5
3 files changed, 18 insertions, 9 deletions
diff --git a/lib/Spreadsheet/Template/Helpers/Xslate.pm b/lib/Spreadsheet/Template/Helpers/Xslate.pm
index bf9b435..e611f1d 100644
--- a/lib/Spreadsheet/Template/Helpers/Xslate.pm
+++ b/lib/Spreadsheet/Template/Helpers/Xslate.pm
@@ -32,14 +32,20 @@ sub format {
}
sub merge {
- my ($package, $contents, $format, $type, $range, %args) = @_;
+ my (
+ $package, $contents, $format, $type, $first_row,
+ $first_col, $last_row, $last_col, %args
+ ) = @_;
return $JSON->encode(
{
- contents => "$contents",
- format => _formats( $package, $format ),
- type => $type,
- range => "$range",
+ contents => "$contents",
+ format => _formats( $package, $format ),
+ type => $type,
+ first_row => $first_row,
+ first_col => $first_col,
+ last_row => $last_row,
+ last_col => $last_col,
(
defined $args{formula}
? ( formula => $args{formula} )
diff --git a/lib/Spreadsheet/Template/Processor/Xslate.pm b/lib/Spreadsheet/Template/Processor/Xslate.pm
index f59b597..fa57380 100644
--- a/lib/Spreadsheet/Template/Processor/Xslate.pm
+++ b/lib/Spreadsheet/Template/Processor/Xslate.pm
@@ -39,12 +39,12 @@ C<"date_time">, and C<%args> contains any other parameters (such as C<formula>,
for instance) to declare for the cell. C<$type> is optional, and if not passed,
defaults to C<"string">.
-=item merge($content, $format, $type, $range, %args)
+=item merge($content, $format, $type, $first_row, $first_col, $last_row, $last_col, %args)
Returns representation of a range of cells to be merged. C<$content> is the
content to be placed in the merged cell. C<$type> is either C<"string">, C<"number">,
-or C<"date_time">. C<$range> is the Excel representation
-of a range of cells, ex: "A1:B10". C<$format> is the name of a format
+or C<"date_time">. C<$first_row>, C<$first_col>, C<$last_row>, C<$last_col> are zero-indexed
+Excel row, column numbers. C<$format> is the name of a format
declared with the C<format> helper or a hashref of format options.
C<%args> contains any other parameters (such as C<formula>,
for instance) to declare for the cell.
diff --git a/lib/Spreadsheet/Template/Writer/Excel.pm b/lib/Spreadsheet/Template/Writer/Excel.pm
index d24b3ae..99f1b7e 100644
--- a/lib/Spreadsheet/Template/Writer/Excel.pm
+++ b/lib/Spreadsheet/Template/Writer/Excel.pm
@@ -170,7 +170,10 @@ sub _write_worksheet {
$sheet->merge_range_type(
$merge->{type},
- $merge->{range},
+ $merge->{first_row},
+ $merge->{first_col},
+ $merge->{last_row},
+ $merge->{last_col},
defined $merge->{formula}
? $merge->{formula}
: $merge->{contents},