-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from Sonichaos360/develop
Multiples improvements and new functions
- Loading branch information
Showing
14 changed files
with
493 additions
and
285 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"name": "sonichaos360/phpsimplespreadsheet", | ||
"description": "Very simple and powerful tool for generate XLSX spreadsheets in PHP with low memory usage.", | ||
"description": "Simple but powerful PHP library to generate on-disk XLSX spreadsheets focused in low memory usage.", | ||
"require": { | ||
"php": "^5.3.3" | ||
"php": ">=5.6" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,58 @@ | ||
<?php | ||
/** | ||
* This file is part of Sonichaos360/PHPSimpleSpreadsheet | ||
* | ||
* Sonichaos360/PHPSimpleSpreadsheet is open source software: you can | ||
* distribute it and/or modify it under the terms of the MIT License | ||
* (the "License"). You may not use this file except in | ||
* compliance with the License. | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or | ||
* implied. See the License for the specific language governing | ||
* permissions and limitations under the License. | ||
* | ||
* @copyright Copyright (c) Luciano Vergara <[email protected]> | ||
* @license https://opensource.org/licenses/MIT MIT License | ||
*/ | ||
|
||
require('../../src/PHPSimpleSpreadsheet.php'); | ||
|
||
$xls = new diblet\PHPSimpleSpreadsheet\PHPSimpleSpreadsheet(); | ||
$xls = new Sonichaos360\PHPSimpleSpreadsheet\PHPSimpleSpreadsheet(); | ||
|
||
$xls | ||
//Sheet Name | ||
->setName('test') | ||
->setName('test') | ||
//Author Name | ||
->setAuthor('Luciano Vergara') | ||
->setAuthor('Luciano Vergara') | ||
//Set Columns range | ||
->setRange(['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I']); | ||
->setRange(['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I']) | ||
//Set Columns width | ||
->setColumnsWidth(['25', '35', '35', '35', '35', '35', '35', '35', '35']); | ||
|
||
//Start Sheet | ||
$xls->startSheet(); | ||
|
||
//SetData | ||
$count = 1; | ||
|
||
//Set header row, style bold | ||
$xls->insertRow(['A DATA', 'B DATA', 'C DATA', 'D DATA', 'E DATA', 'F DATA', 'G DATA', 'H DATA', 'I DATA'], "bold"); | ||
|
||
//Increment row count | ||
$count++; | ||
|
||
//Add data using insertRow and pass range ordered array values | ||
while($count <= 10) | ||
{ | ||
while ($count <= 10) { | ||
//Set row data | ||
$xls->insertRow(['A DATA', 'B DATA', 'C DATA', 'D DATA', 'E DATA', 'F DATA', 'G DATA', 'H DATA', 'I DATA']); | ||
|
||
if($count == 5) { | ||
$xls->insertRow(['A DATA', 'B DATA', 'C DATA', 'D DATA', 'E DATA', 'F DATA', 'G DATA', 'H DATA', 'I DATA'], "italic"); | ||
} else { | ||
$xls->insertRow(['A DATA', 'B DATA', 'C DATA', 'D DATA', 'E DATA', 'F DATA', 'G DATA', 'H DATA', 'I DATA']); | ||
} | ||
|
||
//Show row number on console | ||
$count++; | ||
} | ||
|
@@ -32,15 +61,12 @@ | |
$xls->endSheet(); | ||
|
||
/* | ||
* Save file (ZIP TO XLSX) if there are so many regs ON your sheet and PHP can't zip the files | ||
* Save file (ZIP TO XLSX) if there are so many regs ON your sheet and PHP can't zip the files | ||
* you can use any other program on your terminal, zip the files and rename the resultant file as NAME.xlsx | ||
* That's all | ||
*/ | ||
if($xls->doXmlx('test.xlsx')) | ||
{ | ||
if ($xls->doXmlx('test.xlsx')) { | ||
echo "File generated successfully. <a href=\"test.xlsx\">OPEN FILE<a>"; | ||
} | ||
else | ||
{ | ||
} else { | ||
throw new Exception('There was a problem generating the Spreadsheet.'); | ||
} |
Oops, something went wrong.