Excel Exporting Template

Exporting table with template

customerNameproductNameproductLineorderDayorderMonthorderYearorderQuarterdollar_sales
Vitachrome Inc. 1937 Lincoln Berline Vintage Cars 10 1 2003 Q1 3,726
Vitachrome Inc. 1936 Mercedes-Benz 500K Special Roadster Vintage Cars 10 1 2003 Q1 1,768
Baane Mini Imports 1952 Alpine Renault 1300 Classic Cars 29 1 2003 Q1 5,572
Baane Mini Imports 1962 LanciaA Delta 16V Classic Cars 29 1 2003 Q1 5,026
Baane Mini Imports 1958 Setra Bus Trucks and Buses 29 1 2003 Q1 3,284
Baane Mini Imports 1940 Ford Pickup Truck Trucks and Buses 29 1 2003 Q1 3,308
Baane Mini Imports 1926 Ford Fire Engine Trucks and Buses 29 1 2003 Q1 1,283
Baane Mini Imports 1913 Ford Model T Speedster Vintage Cars 29 1 2003 Q1 2,489
Baane Mini Imports 1934 Ford V8 Coupe Vintage Cars 29 1 2003 Q1 2,164
Baane Mini Imports 18th Century Vintage Horse Carriage Vintage Cars 29 1 2003 Q1 2,173
Baane Mini Imports 1917 Maxwell Touring Car Vintage Cars 29 1 2003 Q1 3,970
Baane Mini Imports 1940s Ford truck Trucks and Buses 29 1 2003 Q1 3,531
Baane Mini Imports 1939 Cadillac Limousine Vintage Cars 29 1 2003 Q1 1,671
Baane Mini Imports 1962 Volkswagen Microbus Trucks and Buses 29 1 2003 Q1 3,864
Baane Mini Imports 1936 Chrysler Airflow Vintage Cars 29 1 2003 Q1 2,216
Baane Mini Imports 1980’s GM Manhattan Express Trucks and Buses 29 1 2003 Q1 2,866
Baane Mini Imports 1996 Peterbilt 379 Stake Bed with Outrigger Trucks and Buses 29 1 2003 Q1 2,851
Baane Mini Imports 1982 Camaro Z28 Classic Cars 29 1 2003 Q1 3,951
Euro+ Shopping Channel 1969 Corvair Monza Classic Cars 31 1 2003 Q1 4,469
Euro+ Shopping Channel 1957 Chevy Pickup Trucks and Buses 31 1 2003 Q1 4,567
Euro+ Shopping Channel 1998 Chrysler Plymouth Prowler Classic Cars 31 1 2003 Q1 3,262
Euro+ Shopping Channel 1964 Mercedes Tour Bus Trucks and Buses 31 1 2003 Q1 3,559
Euro+ Shopping Channel 1992 Ferrari 360 Spider red Classic Cars 31 1 2003 Q1 3,817
Euro+ Shopping Channel 1970 Triumph Spitfire Classic Cars 31 1 2003 Q1 4,530
Euro+ Shopping Channel 1970 Dodge Coronet Classic Cars 31 1 2003 Q1 1,821
Euro+ Shopping Channel 1958 Chevy Corvette Limited Edition Classic Cars 31 1 2003 Q1 1,338
Euro+ Shopping Channel 1992 Porsche Cayenne Turbo Silver Classic Cars 31 1 2003 Q1 2,768
Euro+ Shopping Channel 1954 Greyhound Scenicruiser Trucks and Buses 31 1 2003 Q1 1,818
Euro+ Shopping Channel 1950's Chicago Surface Lines Streetcar Trains 31 1 2003 Q1 2,771
Euro+ Shopping Channel Diamond T620 Semi-Skirted Tanker Trucks and Buses 31 1 2003 Q1 3,781
Euro+ Shopping Channel 1962 City of Detroit Streetcar Trains 31 1 2003 Q1 1,706
Danish Wholesale Imports 1972 Alfa Romeo GTA Classic Cars 11 2 2003 Q1 6,392
Danish Wholesale Imports 2001 Ferrari Enzo Classic Cars 11 2 2003 Q1 8,435
Danish Wholesale Imports 1969 Ford Falcon Classic Cars 11 2 2003 Q1 4,115
Danish Wholesale Imports 1903 Ford Model A Vintage Cars 11 2 2003 Q1 3,005
Danish Wholesale Imports Collectable Wooden Train Trains 11 2 2003 Q1 3,334
Danish Wholesale Imports 1904 Buick Runabout Vintage Cars 11 2 2003 Q1 3,095
Danish Wholesale Imports 18th century schooner Ships 11 2 2003 Q1 5,073
Danish Wholesale Imports 1912 Ford Model T Delivery Wagon Vintage Cars 11 2 2003 Q1 3,232
Danish Wholesale Imports 1940 Ford Delivery Sedan Vintage Cars 11 2 2003 Q1 3,774
Danish Wholesale Imports The Schooner Bluenose Ships 11 2 2003 Q1 2,214
Danish Wholesale Imports The Mayflower Ships 11 2 2003 Q1 2,512
Danish Wholesale Imports The USS Constitution Ship Ships 11 2 2003 Q1 1,882
Danish Wholesale Imports The Titanic Ships 11 2 2003 Q1 3,594
Danish Wholesale Imports The Queen Mary Ships 11 2 2003 Q1 2,185
Danish Wholesale Imports Pont Yacht Ships 11 2 2003 Q1 1,119
Rovelli Gifts 1980s Black Hawk Helicopter Planes 17 2 2003 Q1 4,825
Rovelli Gifts P-51-D Mustang Planes 17 2 2003 Q1 2,757
Rovelli Gifts 1999 Yamaha Speed Boat Ships 17 2 2003 Q1 3,315
Rovelli Gifts 1941 Chevrolet Special Deluxe Cabriolet Vintage Cars 17 2 2003 Q1 3,863
Rovelli Gifts 1928 British Royal Navy Airplane Planes 17 2 2003 Q1 3,002
Rovelli Gifts 1900s Vintage Bi-Plane Planes 17 2 2003 Q1 3,223
Rovelli Gifts 1937 Horch 930V Limousine Vintage Cars 17 2 2003 Q1 1,733
Rovelli Gifts Corsair F4U ( Bird Cage) Planes 17 2 2003 Q1 2,798
Rovelli Gifts 1900s Vintage Tri-Plane Planes 17 2 2003 Q1 1,846
Rovelli Gifts 1928 Ford Phaeton Deluxe Vintage Cars 17 2 2003 Q1 2,157
Rovelli Gifts 1930 Buick Marquette Phaeton Vintage Cars 17 2 2003 Q1 1,395
Rovelli Gifts American Airlines: B767-300 Planes 17 2 2003 Q1 2,832
Rovelli Gifts HMS Bounty Ships 17 2 2003 Q1 2,553
Rovelli Gifts America West Airlines B757-200 Planes 17 2 2003 Q1 3,390
Rovelli Gifts ATA: B757-300 Planes 17 2 2003 Q1 3,645
Rovelli Gifts F/A 18 Hornet 1/72 Planes 17 2 2003 Q1 3,344
Rovelli Gifts American Airlines: MD-11S Planes 17 2 2003 Q1 3,376
Rovelli Gifts Boeing X-32A JSF Planes 17 2 2003 Q1 2,098
Land of Toys Inc. 1969 Harley Davidson Ultimate Chopper Motorcycles 24 2 2003 Q1 2,441
Land of Toys Inc. 1996 Moto Guzzi 1100i Motorcycles 24 2 2003 Q1 4,129
Land of Toys Inc. 2003 Harley-Davidson Eagle Drag Bike Motorcycles 24 2 2003 Q1 4,654
Land of Toys Inc. 2002 Suzuki XREO Motorcycles 24 2 2003 Q1 2,562
Land of Toys Inc. 1936 Harley Davidson El Knucklehead Motorcycles 24 2 2003 Q1 1,528
Land of Toys Inc. 1997 BMW R 1100 S Motorcycles 24 2 2003 Q1 2,423
Land of Toys Inc. 1960 BSA Gold Star DBD34 Motorcycles 24 2 2003 Q1 2,779
Land of Toys Inc. 1997 BMW F650 ST Motorcycles 24 2 2003 Q1 1,778
Cruz & Sons Co. 1968 Ford Mustang Classic Cars 3 3 2003 Q1 5,458
Cruz & Sons Co. 1968 Dodge Charger Classic Cars 3 3 2003 Q1 4,334
Cruz & Sons Co. 1970 Plymouth Hemi Cuda Classic Cars 3 3 2003 Q1 2,957
Cruz & Sons Co. 1969 Dodge Charger Classic Cars 3 3 2003 Q1 3,856
Cruz & Sons Co. 1948 Porsche 356-A Roadster Classic Cars 3 3 2003 Q1 2,575
Cruz & Sons Co. 1969 Dodge Super Bee Classic Cars 3 3 2003 Q1 1,902
Cruz & Sons Co. 1976 Ford Gran Torino Classic Cars 3 3 2003 Q1 3,836
Cruz & Sons Co. 1957 Vespa GS150 Motorcycles 3 3 2003 Q1 2,272
Cruz & Sons Co. 1957 Corvette Convertible Classic Cars 3 3 2003 Q1 6,154
Cruz & Sons Co. 1982 Ducati 900 Monster Motorcycles 3 3 2003 Q1 2,254
Cruz & Sons Co. 1971 Alpine Renault 1600s Classic Cars 3 3 2003 Q1 1,800
Cruz & Sons Co. 1956 Porsche 356A Coupe Classic Cars 3 3 2003 Q1 5,280
Cruz & Sons Co. 1961 Chevrolet Impala Classic Cars 3 3 2003 Q1 2,080
Cruz & Sons Co. 1982 Ducati 996 R Motorcycles 3 3 2003 Q1 978
Cruz & Sons Co. 1974 Ducati 350 Mk3 Desmo Motorcycles 3 3 2003 Q1 2,721
Cruz & Sons Co. 2002 Yamaha YZR M1 Motorcycles 3 3 2003 Q1 2,545
Motor Mint Distributors Inc. 1993 Mazda RX-7 Classic Cars 10 3 2003 Q1 3,054
Motor Mint Distributors Inc. 1995 Honda Civic Classic Cars 10 3 2003 Q1 5,243
Motor Mint Distributors Inc. 1999 Indy 500 Monte Carlo SS Classic Cars 10 3 2003 Q1 3,295
Motor Mint Distributors Inc. 1992 Ferrari 360 Spider red Classic Cars 10 3 2003 Q1 7,400
Motor Mint Distributors Inc. 1948 Porsche Type 356 Roadster Classic Cars 10 3 2003 Q1 5,910
Motor Mint Distributors Inc. 1982 Lamborghini Diablo Classic Cars 10 3 2003 Q1 931
AV Stores, Co. 1965 Aston Martin DB5 Classic Cars 18 3 2003 Q1 4,374
AV Stores, Co. 1917 Grand Touring Sedan Vintage Cars 18 3 2003 Q1 6,426
AV Stores, Co. 1911 Ford Town Car Vintage Cars 18 3 2003 Q1 1,647
AV Stores, Co. 1932 Model A Ford J-Coupe Vintage Cars 18 3 2003 Q1 3,818
AV Stores, Co. 1928 Mercedes-Benz SSK Vintage Cars 18 3 2003 Q1 5,074
AV Stores, Co. 1932 Alfa Romeo 8C2300 Spider Sport Vintage Cars 18 3 2003 Q1 2,293
AV Stores, Co. 1957 Ford Thunderbird Classic Cars 18 3 2003 Q1 2,604
AV Stores, Co. 1970 Chevy Chevelle SS 454 Classic Cars 18 3 2003 Q1 2,593
AV Stores, Co. 1966 Shelby Cobra 427 S/C Classic Cars 18 3 2003 Q1 1,255
AV Stores, Co. 1939 Chevrolet Deluxe Coupe Vintage Cars 18 3 2003 Q1 578
AV Stores, Co. 1938 Cadillac V-16 Presidential Limousine Vintage Cars 18 3 2003 Q1 1,590
AV Stores, Co. 1949 Jaguar XK 120 Classic Cars 18 3 2003 Q1 3,556
AV Stores, Co. 1952 Citroen-15CV Classic Cars 18 3 2003 Q1 5,186
AV Stores, Co. 1969 Chevrolet Camaro Z28 Classic Cars 18 3 2003 Q1 2,173
AV Stores, Co. 2002 Chevy Corvette Classic Cars 18 3 2003 Q1 3,566
AV Stores, Co. 1936 Mercedes Benz 500k Roadster Vintage Cars 18 3 2003 Q1 1,694
Mini Wheels Co. 1937 Lincoln Berline Vintage Cars 25 3 2003 Q1 2,882
Mini Wheels Co. 1936 Mercedes-Benz 500K Special Roadster Vintage Cars 25 3 2003 Q1 2,329
Mini Wheels Co. 1934 Ford V8 Coupe Vintage Cars 25 3 2003 Q1 1,487
Mini Wheels Co. 18th Century Vintage Horse Carriage Vintage Cars 25 3 2003 Q1 4,053
Mini Wheels Co. 1917 Maxwell Touring Car Vintage Cars 25 3 2003 Q1 3,560
Mini Wheels Co. 1936 Chrysler Airflow Vintage Cars 25 3 2003 Q1 2,228
Volvo Model Replicas, Co 1952 Alpine Renault 1300 Classic Cars 24 3 2003 Q1 5,718
Volvo Model Replicas, Co 1913 Ford Model T Speedster Vintage Cars 24 3 2003 Q1 1,957
Mini Gifts Distributors Ltd. 1958 Setra Bus Trucks and Buses 26 3 2003 Q1 2,554
Mini Gifts Distributors Ltd. 1940 Ford Pickup Truck Trucks and Buses 26 3 2003 Q1 4,974
Mini Gifts Distributors Ltd. 1939 Cadillac Limousine Vintage Cars 26 3 2003 Q1 2,164
Mini Gifts Distributors Ltd. 1996 Peterbilt 379 Stake Bed with Outrigger Trucks and Buses 26 3 2003 Q1 1,353
La Corne D'abondance, Co. 1962 LanciaA Delta 16V Classic Cars 1 4 2003 Q2 3,984
La Corne D'abondance, Co. 1964 Mercedes Tour Bus Trucks and Buses 1 4 2003 Q2 4,164
La Corne D'abondance, Co. 1926 Ford Fire Engine Trucks and Buses 1 4 2003 Q2 2,407
La Corne D'abondance, Co. 1992 Ferrari 360 Spider red Classic Cars 1 4 2003 Q2 8,128
La Corne D'abondance, Co. 1940s Ford truck Trucks and Buses 1 4 2003 Q2 4,319
La Corne D'abondance, Co. 1962 Volkswagen Microbus Trucks and Buses 1 4 2003 Q2 2,147
La Corne D'abondance, Co. 1958 Chevy Corvette Limited Edition Classic Cars 1 4 2003 Q2 687
La Corne D'abondance, Co. 1980’s GM Manhattan Express Trucks and Buses 1 4 2003 Q2 2,836
La Corne D'abondance, Co. 1954 Greyhound Scenicruiser Trucks and Buses 1 4 2003 Q2 1,227
La Corne D'abondance, Co. 1982 Camaro Z28 Classic Cars 1 4 2003 Q2 3,483
Classic Legends Inc. 1957 Chevy Pickup Trucks and Buses 4 4 2003 Q2 5,124
Classic Legends Inc. 1998 Chrysler Plymouth Prowler Classic Cars 4 4 2003 Q2 6,477
Classic Legends Inc. 1970 Dodge Coronet Classic Cars 4 4 2003 Q2 2,662
Classic Legends Inc. 1992 Porsche Cayenne Turbo Silver Classic Cars 4 4 2003 Q2 4,684
Classic Legends Inc. Diamond T620 Semi-Skirted Tanker Trucks and Buses 4 4 2003 Q2 2,719
Royale Belge 1950's Chicago Surface Lines Streetcar Trains 11 4 2003 Q2 1,628
Dragon Souveniers, Ltd. 2001 Ferrari Enzo Classic Cars 16 4 2003 Q2 6,446
Dragon Souveniers, Ltd. 1969 Corvair Monza Classic Cars 16 4 2003 Q2 6,367
Dragon Souveniers, Ltd. 1969 Ford Falcon Classic Cars 16 4 2003 Q2 6,748
Dragon Souveniers, Ltd. 1903 Ford Model A Vintage Cars 16 4 2003 Q2 3,161
Dragon Souveniers, Ltd. Collectable Wooden Train Trains 16 4 2003 Q2 1,715
Dragon Souveniers, Ltd. 1970 Triumph Spitfire Classic Cars 16 4 2003 Q2 2,686
Dragon Souveniers, Ltd. 1904 Buick Runabout Vintage Cars 16 4 2003 Q2 1,696
Dragon Souveniers, Ltd. 18th century schooner Ships 16 4 2003 Q2 4,887
Dragon Souveniers, Ltd. 1962 City of Detroit Streetcar Trains 16 4 2003 Q2 1,169
Dragon Souveniers, Ltd. The Mayflower Ships 16 4 2003 Q2 2,863
Dragon Souveniers, Ltd. The Queen Mary Ships 16 4 2003 Q2 4,022
Dragon Souveniers, Ltd. Pont Yacht Ships 16 4 2003 Q2 2,621
Enaco Distributors The Titanic Ships 21 4 2003 Q2 3,101
Salzburg Collectables 1972 Alfa Romeo GTA Classic Cars 28 4 2003 Q2 5,192
Salzburg Collectables 1980s Black Hawk Helicopter Planes 28 4 2003 Q2 6,509
Salzburg Collectables 1999 Yamaha Speed Boat Ships 28 4 2003 Q2 1,572
Salzburg Collectables 1941 Chevrolet Special Deluxe Cabriolet Vintage Cars 28 4 2003 Q2 2,573
Salzburg Collectables 1900s Vintage Bi-Plane Planes 28 4 2003 Q2 2,640
Salzburg Collectables 1912 Ford Model T Delivery Wagon Vintage Cars 28 4 2003 Q2 2,540
Salzburg Collectables 1937 Horch 930V Limousine Vintage Cars 28 4 2003 Q2 1,262
Salzburg Collectables 1940 Ford Delivery Sedan Vintage Cars 28 4 2003 Q2 2,876
Salzburg Collectables Corsair F4U ( Bird Cage) Planes 28 4 2003 Q2 1,739
Salzburg Collectables The Schooner Bluenose Ships 28 4 2003 Q2 1,434
Salzburg Collectables HMS Bounty Ships 28 4 2003 Q2 2,153
Salzburg Collectables The USS Constitution Ship Ships 28 4 2003 Q2 2,554
Salzburg Collectables American Airlines: MD-11S Planes 28 4 2003 Q2 1,655
Salzburg Collectables Boeing X-32A JSF Planes 28 4 2003 Q2 1,126
Australian Collectors, Co. 1996 Moto Guzzi 1100i Motorcycles 29 4 2003 Q2 3,449
Australian Collectors, Co. 2003 Harley-Davidson Eagle Drag Bike Motorcycles 29 4 2003 Q2 7,305
Australian Collectors, Co. P-51-D Mustang Planes 29 4 2003 Q2 2,401
Australian Collectors, Co. 1936 Harley Davidson El Knucklehead Motorcycles 29 4 2003 Q2 2,647
Australian Collectors, Co. 1997 BMW R 1100 S Motorcycles 29 4 2003 Q2 3,866
Australian Collectors, Co. 1928 British Royal Navy Airplane Planes 29 4 2003 Q2 3,627
Australian Collectors, Co. 1960 BSA Gold Star DBD34 Motorcycles 29 4 2003 Q2 2,460
Australian Collectors, Co. 1900s Vintage Tri-Plane Planes 29 4 2003 Q2 2,080
Australian Collectors, Co. 1997 BMW F650 ST Motorcycles 29 4 2003 Q2 2,088
Australian Collectors, Co. 1928 Ford Phaeton Deluxe Vintage Cars 29 4 2003 Q2 1,995
Australian Collectors, Co. 1930 Buick Marquette Phaeton Vintage Cars 29 4 2003 Q2 2,032
Australian Collectors, Co. American Airlines: B767-300 Planes 29 4 2003 Q2 4,293
Australian Collectors, Co. America West Airlines B757-200 Planes 29 4 2003 Q2 1,962
Australian Collectors, Co. ATA: B757-300 Planes 29 4 2003 Q2 2,563
Australian Collectors, Co. F/A 18 Hornet 1/72 Planes 29 4 2003 Q2 3,096
Reims Collectables 1969 Harley Davidson Ultimate Chopper Motorcycles 7 5 2003 Q2 2,928
Reims Collectables 2002 Suzuki XREO Motorcycles 7 5 2003 Q2 6,326
Reims Collectables 1982 Ducati 900 Monster Motorcycles 7 5 2003 Q2 1,862
Reims Collectables 1974 Ducati 350 Mk3 Desmo Motorcycles 7 5 2003 Q2 2,398
Reims Collectables 2002 Yamaha YZR M1 Motorcycles 7 5 2003 Q2 3,186
Marseille Mini Autos 1968 Ford Mustang Classic Cars 8 5 2003 Q2 6,538
Marseille Mini Autos 1968 Dodge Charger Classic Cars 8 5 2003 Q2 4,215
Marseille Mini Autos 1970 Plymouth Hemi Cuda Classic Cars 8 5 2003 Q2 2,094
Marseille Mini Autos 1969 Dodge Charger Classic Cars 8 5 2003 Q2 2,096
Marseille Mini Autos 1993 Mazda RX-7 Classic Cars 8 5 2003 Q2 3,898
Marseille Mini Autos 1948 Porsche 356-A Roadster Classic Cars 8 5 2003 Q2 2,682
Marseille Mini Autos 1995 Honda Civic Classic Cars 8 5 2003 Q2 3,528
Marseille Mini Autos 1992 Ferrari 360 Spider red Classic Cars 8 5 2003 Q2 3,429
Marseille Mini Autos 1969 Dodge Super Bee Classic Cars 8 5 2003 Q2 1,452
Marseille Mini Autos 1976 Ford Gran Torino Classic Cars 8 5 2003 Q2 2,809
Marseille Mini Autos 1957 Vespa GS150 Motorcycles 8 5 2003 Q2 2,067
Marseille Mini Autos 1957 Corvette Convertible Classic Cars 8 5 2003 Q2 4,083
Marseille Mini Autos 1982 Lamborghini Diablo Classic Cars 8 5 2003 Q2 1,355
Marseille Mini Autos 1971 Alpine Renault 1600s Classic Cars 8 5 2003 Q2 1,728
Marseille Mini Autos 1956 Porsche 356A Coupe Classic Cars 8 5 2003 Q2 5,857

This example demonstrates how to export table to an excel file.

<div>
    <?php
    \koolreport\Excel\Table::create(array(
        ...
    ));
    ?>
</div>
<?php
require_once "MyReport.php";

$report = new MyReport;
$report->run()->render();
<?php
require_once "../../../load.koolreport.php";

use \koolreport\processes\Map;
use \koolreport\processes\Limit;
use \koolreport\processes\Filter;
use \koolreport\cube\processes\Cube;
use \koolreport\pivot\processes\Pivot;

class MyReport extends koolreport\KoolReport
{
    use \koolreport\export\Exportable;
    use \koolreport\excel\ExcelExportable;
    use \koolreport\excel\BigSpreadsheetExportable;

    function settings()
    {
        return array(
            "dataSources" => array(
                "dollarsales"=>array(
                    'filePath' => '../../../databases/customer_product_dollarsales2.csv',
                    'fieldSeparator' => ';',
                    'class' => "\koolreport\datasources\CSVDataSource"      
                ), 
            )
        );
    }    function setup()
    {
        $node = $this->src('dollarsales')
        //->query('select *, dollar_sales as dollar_sales2 from customer_product_dollarsales2')
        ->pipe(new Map([
            '{value}' => function($row, $meta) {
                $row['orderQuarter'] = 'Q' . $row['orderQuarter'];
                return $row;
            },
            '{meta}' => function($meta) {
                $meta['columns']['orderDate']['type'] = 'datetime';
                $meta['columns']['orderQuarter']['type'] = 'string';
                return $meta;
            }
        ]))
        ;

        $node
        ->pipe(new Limit(array(
            200, 0
        )))
        ->pipe(new Map([
            "{meta}" => function($meta) {
                $cMeta = & $meta["columns"]["dollar_sales"];
                $cMeta["footer"] = "sum";
                $cMeta["type"] = "number";
                // print_r($meta); exit;
                return $meta;
            }
        ]))
        ->pipe($this->dataStore('orders'));

    }
}
<?php
use \koolreport\pivot\widgets\PivotTable;
use \koolreport\widgets\koolphp\Table;
?>
<div class="report-content">
	<div style='text-align: center;margin-bottom:30px;'>
        <h1>Excel Exporting Template</h1>
        <p class="lead">Exporting table with template</p>
		<form method="post">
			<button type="submit" class="btn btn-primary" formaction="export.php?type=excel">Download Excel</button>
			<button type="submit" class="btn btn-primary" formaction="export.php?type=bigspreadsheet">Download Big Spreadsheet</button>
		</form>
	</div>
	<div class='box-container'>
		<div>
			<?php
			Table::create(array(
				"dataSource" => $this->dataStore('orders'),
				"columns"=>array(
					"customerName",
					"productName",
					"productLine",
					"orderDay",
					"orderMonth",
					"orderYear",
					"orderQuarter",
					"dollar_sales"=>array(
						"type"=>"number",
					)
				),
				"paging"=>array(
					"pageSize"=>5
				)
			));
			?>
		</div>
	</div>
</div>
<?php
    $sheet1 = "Sales by Customer";
?>
<meta charset="UTF-8">
<meta name="description" content="Free Web tutorials">
<meta name="keywords" content="Excel,HTML,CSS,XML,JavaScript">
<meta name="creator" content="John Doe">
<meta name="subject" content="subject1">
<meta name="title" content="title1">
<meta name="category" content="category1">

<div sheet-name="<?php echo $sheet1; ?>">
    <?php
    $styleArray = [
        'font' => [
            'name' => 'Calibri', //'Verdana', 'Arial'
            'size' => 30,
            'bold' => true,
            'italic' => FALSE,
            'underline' => 'none', //'double', 'doubleAccounting', 'single', 'singleAccounting'
            'strikethrough' => FALSE,
            'superscript' => false,
            'subscript' => false,
            'color' => [
                'rgb' => '000000',
                'argb' => 'FF000000',
            ]
        ],
        'alignment' => [
            'horizontal' => 'general',//left, right, center, centerContinuous, justify, fill, distributed
            'vertical' => 'bottom',//top, center, justify, distributed
            'textRotation' => 0,
            'wrapText' => false,
            'shrinkToFit' => false,
            'indent' => 0,
            'readOrder' => 0,
        ],
        'borders' => [
            'top' => [
                'borderStyle' => 'none', //dashDot, dashDotDot, dashed, dotted, double, hair, medium, mediumDashDot, mediumDashDotDot, mediumDashed, slantDashDot, thick, thin
                'color' => [
                    'rgb' => '808080',
                    'argb' => 'FF808080',
                ]
            ],
            //left, right, bottom, diagonal, allBorders, outline, inside, vertical, horizontal
        ],
        'fill' => [
            'fillType' => 'none', //'solid', 'linear', 'path', 'darkDown', 'darkGray', 'darkGrid', 'darkHorizontal', 'darkTrellis', 'darkUp', 'darkVertical', 'gray0625', 'gray125', 'lightDown', 'lightGray', 'lightGrid', 'lightHorizontal', 'lightTrellis', 'lightUp', 'lightVertical', 'mediumGray'
            'rotation' => 90,
            'color' => [
                'rgb' => 'A0A0A0',
                'argb' => 'FFA0A0A0',
            ],
            'startColor' => [
                'rgb' => 'A0A0A0',
                'argb' => 'FFA0A0A0',
            ],
            'endColor' => [
                'argb' => 'FFFFFF',
                'argb' => 'FFFFFFFF',
            ],
        ],
    ];
    ?>
    <div>Orders Table</div>

    <div>
        <?php
        \koolreport\excel\Table::create(array(
            "dataSource" => $this->dataStore('orders'),
            // "dataSource" => 'orders',
            // "filtering" => ['age','between',45,65],
            "filtering" => function($row, $index) { 
                if (stripos($row['customerName'], "Baane Mini Imports") !== false)
                    return false;
                return true;
            },
            "sorting" => ['dollar_sales' => 'desc'],
            "paging" => [5, 2],
            "showHeader" => false, //default: true
            "showBottomHeader" => true, //default: false
            "showFooter" => true, //default: false
            "map" => [
                "header" => function($colName) { return $colName; },
                "bottomHeader" => function($colName) { return $colName; },
                "cell" => function($colName, $value, $row) { return $value; },
                "footer" => function($colName, $footerValue) { return $footerValue; },
            ],
            "excelStyle" => [
                "header" => function($colName) { 
                    return [
                        'font' => [
                            'italic' => true,
                            'bold' => false,
                            'color' => [
                                'rgb' => '808080',
                            ]
                        ],
                    ]; 
                },
                "bottomHeader" => function($colName) { return []; },
                "cell" => function($colName, $value, $row) { 
                    return [
                        'font' => [
                            'italic' => true,
                            'color' => [
                                'rgb' => '808080',
                            ]
                        ],
                    ]; 
                 },
                "footer" => function($colName, $footerValue) { return []; },
            ]
        ));
        ?>
    </div>
    
</div>
<?php
include "MyReport.php";
$report = new MyReport;
$report->run();

$exportType = $_GET["type"];
if ($exportType === "excel") {
    $report->exportToExcel('MyReportExcel')->toBrowser("MyReportExcel.xlsx");
} else {
    $report->exportToXLSX('MyReportExcel')->toBrowser("MyReportBigSpreadsheet.xlsx");
}
customerNameproductNameproductLineorderDateorderDayorderMonthorderYearorderQuarterdollar_sales
Vitachrome Inc. 1937 Lincoln Berline Vintage Cars 2003-01-10 00:00:00 10 1 2003 1 3726.45
Vitachrome Inc. 1936 Mercedes-Benz 500K Special Roadster Vintage Cars 2003-01-10 00:00:00 10 1 2003 1 1768.33
Baane Mini Imports 1952 Alpine Renault 1300 Classic Cars 2003-01-29 00:00:00 29 1 2003 1 5571.8
Baane Mini Imports 1962 LanciaA Delta 16V Classic Cars 2003-01-29 00:00:00 29 1 2003 1 5026.14
Baane Mini Imports 1958 Setra Bus Trucks and Buses 2003-01-29 00:00:00 29 1 2003 1 3284.28
Baane Mini Imports 1940 Ford Pickup Truck Trucks and Buses 2003-01-29 00:00:00 29 1 2003 1 3307.5
Baane Mini Imports 1926 Ford Fire Engine Trucks and Buses 2003-01-29 00:00:00 29 1 2003 1 1283.48
Baane Mini Imports 1913 Ford Model T Speedster Vintage Cars 2003-01-29 00:00:00 29 1 2003 1 2489.13
Baane Mini Imports 1934 Ford V8 Coupe Vintage Cars 2003-01-29 00:00:00 29 1 2003 1 2164.4
Baane Mini Imports 18th Century Vintage Horse Carriage Vintage Cars 2003-01-29 00:00:00 29 1 2003 1 2173

What People Are Saying

"KoolReport helps me very much in creating data report for my corporate! Keep up your good work!"
-- Alain Melsens

"The first use of your product. I was impressed by its easiness and powerfulness. This product is a great and amazing."
-- Dr. Lew Choy Onn

"Fantastic framework for reporting!"
-- Greg Schneider

Download KoolReport Get KoolReport Pro