Skip to content

Commit bbca426

Browse files
committed
Fix bower dependency
1 parent 7bc6a65 commit bbca426

File tree

5 files changed

+52
-49
lines changed

5 files changed

+52
-49
lines changed

.bowerrc

Lines changed: 0 additions & 3 deletions
This file was deleted.

README.md

Lines changed: 49 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -17,52 +17,55 @@ Usage
1717
=================
1818

1919
```php
20-
require_once('../PHPExcelFormatter.php');
21-
22-
try
23-
{
24-
// Load file
25-
$formatter = new PHPExcelFormatter('example1.xls');
26-
27-
// Output columns array (document must have column names on first row)
28-
$formatterColumns = array(
29-
'username' => 'username',
30-
'phone' => 'phone_no',
31-
'email' => 'email_address'
32-
);
33-
34-
// Output columns array (document dosen't have column names on first row)
35-
// Skip foruth column (age) (third in array), because we don't need that data
36-
// NOTE: if document dosen't have column names on first line, second parameter for PHPExcelFormatter should be $readColumns = false, otherwise it will skip first line of data
37-
$formatterColumns = array(
38-
'username',
39-
'email_address',
40-
'phone',
41-
4 => 'sex'
42-
);
43-
44-
// Set our columns
45-
$formatter->setFormatterColumns($formatterColumns);
46-
47-
// Output as array
48-
$output = $formatter->output('a');
49-
50-
// Print array
51-
echo '<pre>'.print_r($output, true).'</pre>';
52-
53-
// Set MySQL table
54-
$formatter->setMySQLTableName('users');
55-
56-
// Output as mysql query
57-
$output = $formatter->output('m');
58-
59-
// Print mysql query
60-
echo '<pre>'.print_r($output, true).'</pre>';
61-
62-
}
63-
catch(PHPExcelFormatterException $e)
64-
{
65-
echo 'Error: '.$e->getMessage();
20+
// Require needed files
21+
require_once('bower_components/PHPExcel/Classes/PHPExcel.php');
22+
require_once('bower_components/phpexcelformatter/PHPExcelFormatter.php');
23+
24+
try{
25+
// Load file
26+
$formatter = new PHPExcelFormatter('example1.xls');
27+
28+
// Output columns array (document must have column names on first row)
29+
$formatterColumns = array(
30+
'username' => 'username',
31+
'phone' => 'phone_no',
32+
'email' => 'email_address'
33+
);
34+
35+
// Output columns array (document dosen't have column names on first row)
36+
// Skip foruth column (age) (third in array), because we don't need that data
37+
// NOTE: if document dosen't have column names on first line, second parameter for PHPExcelFormatter should be $readColumns = false, otherwise it will skip first line of data
38+
$formatterColumns = array(
39+
'username',
40+
'email_address',
41+
'phone',
42+
4 => 'sex'
43+
);
44+
45+
// Set our columns
46+
$formatter->setFormatterColumns($formatterColumns);
47+
48+
// Output as array
49+
$output = $formatter->output('a');
50+
// OR
51+
// $output = $formatter->output('array');
52+
53+
// Print array
54+
echo '<pre>'.print_r($output, true).'</pre>';
55+
56+
// Set MySQL table
57+
$formatter->setMySQLTableName('users');
58+
59+
// Output as mysql query
60+
$output = $formatter->output('m');
61+
// OR
62+
// $output = $formatter->output('mysql');
63+
64+
// Print mysql query
65+
echo '<pre>'.print_r($output, true).'</pre>';
66+
67+
}catch(PHPExcelFormatterException $e){
68+
echo 'Error: '.$e->getMessage();
6669
}
6770
```
6871

examples/example1.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* @author Rene Korss <[email protected]>
66
*/
77

8+
require_once('../../bower_components/PHPExcel/Classes/PHPExcel.php');
89
require_once('../PHPExcelFormatter.php');
910

1011
try

examples/example2.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* @author Rene Korss <[email protected]>
66
*/
77

8+
require_once('../../bower_components/PHPExcel/Classes/PHPExcel.php');
89
require_once('../PHPExcelFormatter.php');
910

1011
try

examples/example3.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* @author Rene Korss <[email protected]>
66
*/
77

8+
require_once('../../bower_components/PHPExcel/Classes/PHPExcel.php');
89
require_once('../PHPExcelFormatter.php');
910

1011
try

0 commit comments

Comments
 (0)