-my $y = 3;
-foreach my $row ($table->rows()) {
- $x = 0;
- $sheet[$y] = [];
- foreach my $cell (@$row) {
- if ($cell and ref($cell) eq 'HTML::ElementTable::DataElement') {
- my $f = 'text';
- if ( $cell->as_HTML =~ /font/i ) {
- my ($el) = $cell->content_list;
- $f = 'size'.$el->attr('size') if $el->attr('size');
- }
- elsif ( $cell->as_text =~ /^\$/ ) {
- $f = 'amount'
- }
- elsif ( $cell->tag eq 'th' ) {
- $f = 'colhead';
- }
- elsif ( $x == 0 ) {
- $f = 'rowhead';
- }
- $sheet[$y][$x] = {
- text => $cell->as_text,
- format => $f,
- rowspan => $cell->attr('rowspan'),
- colspan => $cell->attr('colspan'),
- };
- }
- $x++;
- } #for $cell
- $y++;
-}
+my $y = 2;
+
+my $colhead = $format[0]->{colhead};
+# print header
+$ws->merge_range($y, 1, $y, 5, 'Sales', $colhead);
+$ws->merge_range($y, 6, $y+1, 8, 'Rate', $colhead);
+$ws->merge_range($y, 9, $y, 14, 'Tax', $colhead);
+
+$y++;
+$colhead = $format[0]->{colhead_small};
+$ws->write($y, 1, [ 'Total', 'Exempt customer', 'Exempt package', 'Monthly exemption',
+ 'Taxable' ], $colhead);
+$ws->write($y, 9, 'Estimated', $colhead);
+$ws->write($y, 10, 'Invoiced', $colhead);
+$ws->write($y, 12, 'Credited', $colhead);
+$ws->write($y, 14, 'Net due', $colhead);
+$y++;