Initial commit
This commit is contained in:
3
vendor/maatwebsite/excel/docs/blade.md
vendored
Normal file
3
vendor/maatwebsite/excel/docs/blade.md
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
@include:Loading a view|load-view
|
||||
@include:Passing variables|vars
|
||||
@include:Styling sheets|styling
|
||||
45
vendor/maatwebsite/excel/docs/blade/load-view.md
vendored
Normal file
45
vendor/maatwebsite/excel/docs/blade/load-view.md
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
# @Blade to Excel
|
||||
|
||||
We can utilise the magic of Laravel's Blade engine to power our Excel export. Sharing a view, loading a view per sheet, creating a html table inside a view, basic CSS styling, ...
|
||||
|
||||
# Loading a view for a single sheet
|
||||
|
||||
We can load a view for every sheet we create with `->loadView()`.
|
||||
|
||||
Excel::create('New file', function($excel) {
|
||||
|
||||
$excel->sheet('New sheet', function($sheet) {
|
||||
|
||||
$sheet->loadView('folder.view');
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
# Using different views for different sheets
|
||||
|
||||
Excel::create('New file', function($excel) {
|
||||
|
||||
$excel->sheet('First sheet', function($sheet) {
|
||||
|
||||
$sheet->loadView('view_first');
|
||||
});
|
||||
|
||||
$excel->sheet('Second sheet', function($sheet) {
|
||||
|
||||
$sheet->loadView('view_second');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
# Sharing a view for all sheets
|
||||
|
||||
We can share a view for all sheets with `shareView()`.
|
||||
|
||||
Excel::shareView('folder.view')->create();
|
||||
|
||||
# Unsetting a view for a sheet
|
||||
|
||||
When we are using a shared view, but we don't want to use a view for the current sheet, we can use `->unsetView()`.
|
||||
|
||||
$sheet->unsetView();
|
||||
124
vendor/maatwebsite/excel/docs/blade/styling.md
vendored
Normal file
124
vendor/maatwebsite/excel/docs/blade/styling.md
vendored
Normal file
@@ -0,0 +1,124 @@
|
||||
# Styling sheets
|
||||
|
||||
### General styling
|
||||
|
||||
If you want to change the general styling of your sheet (not cell or range specific), you can use the `->setStyle()` method or any of the other setters which can be found inside the export documentation.
|
||||
|
||||
// Font family
|
||||
$sheet->setFontFamily('Comic Sans MS');
|
||||
|
||||
// Set font with ->setStyle()`
|
||||
$sheet->setStyle(array(
|
||||
'font' => array(
|
||||
'name' => 'Calibri',
|
||||
'size' => 12,
|
||||
'bold' => true
|
||||
)
|
||||
));
|
||||
|
||||
### Styling with PHPExcel methods
|
||||
|
||||
It's possible to style the sheets and specific cells with help of PHPExcel methods. This package includes a lot of shortcuts (see export documentation), but also always the use of the native methods.
|
||||
|
||||
// Set background color for a specific cell
|
||||
$sheet->getStyle('A1')->applyFromArray(array(
|
||||
'fill' => array(
|
||||
'type' => PHPExcel_Style_Fill::FILL_SOLID,
|
||||
'color' => array('rgb' => 'FF0000')
|
||||
)
|
||||
));
|
||||
|
||||
### Using HTML tags
|
||||
|
||||
Most of the HTML tags are supported.
|
||||
|
||||
<html>
|
||||
|
||||
<!-- Headings -->
|
||||
<td><h1>Big title</h1></td>
|
||||
|
||||
<!-- Bold -->
|
||||
<td><b>Bold cell</b></td>
|
||||
<td><strong>Bold cell</strong></td>
|
||||
|
||||
<!-- Italic -->
|
||||
<td><i>Italic cell</i></td>
|
||||
|
||||
<!-- Images -->
|
||||
<td><img src="img.jpg" /></td>
|
||||
|
||||
</html>
|
||||
|
||||
> Inside the `view.php` config you can change how these tags will be interpreted by Excel by default.
|
||||
|
||||
### Using HTML attributes
|
||||
|
||||
Some of the basic styling can be done with HTML attributes.
|
||||
|
||||
<html>
|
||||
|
||||
<!-- Horizontal alignment -->
|
||||
<td align="right">Big title</td>
|
||||
|
||||
<!-- Vertical alignment -->
|
||||
<td valign="middle">Bold cell</td>
|
||||
|
||||
<!-- Rowspan -->
|
||||
<td rowspan="3">Bold cell</td>
|
||||
|
||||
<!-- Colspan -->
|
||||
<td colspan="6">Italic cell</td>
|
||||
|
||||
<!-- Width -->
|
||||
<td width="100">Cell with width of 100</td>
|
||||
|
||||
<!-- Height -->
|
||||
<td height="100">Cell with height of 100</td>
|
||||
|
||||
</html>
|
||||
|
||||
### Styling through inline-styles
|
||||
|
||||
It's possible to use inline styles inside your view files. Most of the general styles are supported.
|
||||
|
||||
<html>
|
||||
|
||||
<!-- Cell with black background -->
|
||||
<td style="background-color: #000000;">Cell</td>
|
||||
|
||||
</html>
|
||||
|
||||
> Inside the reference guide you can find a list of supported styles.
|
||||
|
||||
### Styling through external CSS file
|
||||
|
||||
**Basic** styling can be done through an external CSS file.
|
||||
At this moment nested CSS is **not** supported yet. Only direct class and ID references will work.
|
||||
|
||||
External css file:
|
||||
|
||||
#cell {
|
||||
background-color: #000000;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.cell {
|
||||
background-color: #000000;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
Table:
|
||||
|
||||
<html>
|
||||
|
||||
{{ HTML::style('css/table.css') }}
|
||||
|
||||
<!-- Cell styled with class -->
|
||||
<td class="cell">Cell</td>
|
||||
|
||||
<!-- Cell styled with ID -->
|
||||
<td id="cell">Cell</td>
|
||||
|
||||
</html>
|
||||
|
||||
> Inside the reference guide you can find a list of supported styles.
|
||||
19
vendor/maatwebsite/excel/docs/blade/vars.md
vendored
Normal file
19
vendor/maatwebsite/excel/docs/blade/vars.md
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
# Passing variables to the view
|
||||
|
||||
### As parameter
|
||||
|
||||
We can pass variables to the view by using the second parameter inside the `loadView()` method.
|
||||
|
||||
$sheet->loadView('view', array('key' => 'value'));
|
||||
|
||||
### With with()
|
||||
|
||||
Alternatively you can use the `with()` method which works the same as with Laravel views.
|
||||
|
||||
// Using normal with()
|
||||
$sheet->loadView('view')
|
||||
->with('key', 'value');
|
||||
|
||||
// using dynamic with()
|
||||
$sheet->loadView('view')
|
||||
->withKey('value');
|
||||
14
vendor/maatwebsite/excel/docs/borders.md
vendored
Normal file
14
vendor/maatwebsite/excel/docs/borders.md
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
PHPExcel_Style_Border::BORDER_NONE = 'none'
|
||||
PHPExcel_Style_Border::BORDER_DASHDOT = 'dashDot'
|
||||
PHPExcel_Style_Border::BORDER_DASHDOTDOT = 'dashDotDot'
|
||||
PHPExcel_Style_Border::BORDER_DASHED = 'dashed'
|
||||
PHPExcel_Style_Border::BORDER_DOTTED = 'dotted'
|
||||
PHPExcel_Style_Border::BORDER_DOUBLE = 'double'
|
||||
PHPExcel_Style_Border::BORDER_HAIR = 'hair'
|
||||
PHPExcel_Style_Border::BORDER_MEDIUM = 'medium'
|
||||
PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT = 'mediumDashDot'
|
||||
PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT = 'mediumDashDotDot'
|
||||
PHPExcel_Style_Border::BORDER_MEDIUMDASHED = 'mediumDashed'
|
||||
PHPExcel_Style_Border::BORDER_SLANTDASHDOT = 'slantDashDot'
|
||||
PHPExcel_Style_Border::BORDER_THICK = 'thick'
|
||||
PHPExcel_Style_Border::BORDER_THIN = 'thin'
|
||||
1
vendor/maatwebsite/excel/docs/changelog.md
vendored
Normal file
1
vendor/maatwebsite/excel/docs/changelog.md
vendored
Normal file
@@ -0,0 +1 @@
|
||||
@include:Version 1|version-1
|
||||
119
vendor/maatwebsite/excel/docs/changelog/version-1.md
vendored
Normal file
119
vendor/maatwebsite/excel/docs/changelog/version-1.md
vendored
Normal file
@@ -0,0 +1,119 @@
|
||||
# Version 1
|
||||
|
||||
### 1.1.5
|
||||
|
||||
- Select sheets by index with `Excel::selectSheetsByIndex(0,1)->load(...)`
|
||||
- Separator typo fix
|
||||
- Added `->setFileName()` method
|
||||
- Use `->setTitle()` only for workbook title not for setting the filename anymore
|
||||
- Made `setAutoSize()` chainable for other sheet methods
|
||||
- Export config setting to disable pre calculation of formulas during export
|
||||
- Export config setting to set the autosizing method (approx|exact)
|
||||
- Auto sizing export from view fix
|
||||
|
||||
### 1.1.4
|
||||
|
||||
- Fix for importing 0 as null
|
||||
- New unit tests
|
||||
|
||||
### 1.1.3
|
||||
|
||||
- Cell writer `->setBorder()` fix
|
||||
|
||||
### 1.1.2
|
||||
|
||||
- Fix for multiple imports on one pageload
|
||||
- Multiple new import heading conversions (`Config: excel::import.heading: true|false|slugged|ascii|numeric|hashed|trans|original`)
|
||||
|
||||
### 1.1.1
|
||||
|
||||
- Retrieve workbook and sheet title during import (`->getTitle()`)
|
||||
|
||||
### 1.1.0
|
||||
|
||||
- `Limit()`, `skip()` and `take()` support for fetching results
|
||||
- Set default page margins
|
||||
- Export Eloquent models directly (`fromModel()`)
|
||||
- Auto generate the first row (table heading) from the array keys
|
||||
- Manipulate cells and cell ranges inside a closure
|
||||
- Set cell backgrounds/fonts/values, ...
|
||||
- Create/append/prepend new row/rows
|
||||
- Manipulate row cells (background, fonts, ...)
|
||||
- Config value default alignment on merge cells
|
||||
- DocBlock updates to support better use of IDE autocomplete features
|
||||
- Parse width and height inside views
|
||||
- Parse images in views
|
||||
- Optional to ASCII conversion of imported header columns (array indices)
|
||||
- Config values for default null comparision and start cells for exports
|
||||
- Changed default CSV enclosure to `"`
|
||||
- Support for Laravel package installer
|
||||
|
||||
### 1.0.9
|
||||
|
||||
- Blade to Excel export fix for PHP5.3
|
||||
|
||||
### 1.0.8
|
||||
|
||||
- File format identifier enhancements
|
||||
|
||||
### 1.0.7
|
||||
|
||||
- Set workbook properties fix
|
||||
- Extra units tests
|
||||
|
||||
### 1.0.6
|
||||
|
||||
- BatchReader fix
|
||||
|
||||
### 1.0.5
|
||||
|
||||
- Date parsing fix
|
||||
|
||||
### 1.0.4
|
||||
|
||||
- Fix calling $this in anonymous function to set locale and cache
|
||||
|
||||
### 1.0.3
|
||||
|
||||
- Table headings to attribute names undefined offset fix
|
||||
- Composer.json enhancements
|
||||
- Documentation fixes
|
||||
|
||||
### 1.0.2
|
||||
|
||||
- Cell Collection fixes
|
||||
- Default autosizing bugfixes
|
||||
- ->load() accepts input encoding parameter
|
||||
- Documentation fixes
|
||||
|
||||
### 1.0.1
|
||||
|
||||
- Column width and row height bugfix
|
||||
- Typo fixes
|
||||
|
||||
### 1.0.0
|
||||
|
||||
- New documentation
|
||||
- More logical file structure (dividing into files, separating the different functionality (import / export)
|
||||
- More optional config settings
|
||||
- CSV Delimiter fixes
|
||||
- CSV Encoding
|
||||
- Import into collections (to support utilisation of ->first(), etc.)
|
||||
- Better column selecting and result limiting
|
||||
- Batch upload
|
||||
- Import dates as Carbon objects by default
|
||||
- Advanced file import through config coordinates
|
||||
- Select sheets to import
|
||||
- Create closure (Excel::create('file', function($excel) { } ))
|
||||
- More logical syntax for creating new files, syntaxes of creating by array and creating with view should be as identical as possible
|
||||
- Rewrite of sheet building for views
|
||||
- Using closures to build sheets for normal sheet creation
|
||||
- Better support for calling native PHPExcel methods
|
||||
- Better use of setters
|
||||
- Config setting to set default store behavior
|
||||
- Column/row width
|
||||
- Share views over all sheets + easy views switching per sheet
|
||||
- External stylesheet with classes/ids parsing for views
|
||||
- Colspan fix
|
||||
- Th default styling
|
||||
- Caching / Cell caching
|
||||
15
vendor/maatwebsite/excel/docs/export.md
vendored
Normal file
15
vendor/maatwebsite/excel/docs/export.md
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
@include:Creating a new file|simple
|
||||
@include:Exporting|export
|
||||
@include:Store to server|store
|
||||
@include:Creating Sheets|sheets
|
||||
@include:Creatings Sheets From array|array
|
||||
@include:Row manipulation|rows
|
||||
@include:Cell manipulation|cells
|
||||
@include:Sheet styling|sheet-styling
|
||||
@include:Freeze rows|freeze
|
||||
@include:Auto filter|autofilter
|
||||
@include:Cell sizing|sizing
|
||||
@include:Auto size|autosize
|
||||
@include:Column merging|merge
|
||||
@include:Column formatting|format
|
||||
@include:PHPExcel methods|call
|
||||
62
vendor/maatwebsite/excel/docs/export/array.md
vendored
Normal file
62
vendor/maatwebsite/excel/docs/export/array.md
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
# Creating a sheet from an array
|
||||
|
||||
## Array
|
||||
|
||||
To create a new file from an array use `->fromArray($source, $nullValue, $startCell, $strictNullComparison, $headingGeneration)` inside the sheet closure.
|
||||
|
||||
Excel::create('Filename', function($excel) {
|
||||
|
||||
$excel->sheet('Sheetname', function($sheet) {
|
||||
|
||||
$sheet->fromArray(array(
|
||||
array('data1', 'data2'),
|
||||
array('data3', 'data4')
|
||||
));
|
||||
|
||||
});
|
||||
|
||||
})->export('xls');
|
||||
|
||||
Alternatively you can use `->with()`.
|
||||
|
||||
$sheet->with(array(
|
||||
array('data1', 'data2'),
|
||||
array('data3', 'data4')
|
||||
));
|
||||
|
||||
If you want to pass variables inside the closure, use `use($data)`
|
||||
|
||||
$data = array(
|
||||
array('data1', 'data2'),
|
||||
array('data3', 'data4')
|
||||
);
|
||||
|
||||
Excel::create('Filename', function($excel) use($data) {
|
||||
|
||||
$excel->sheet('Sheetname', function($sheet) use($data) {
|
||||
|
||||
$sheet->fromArray($data);
|
||||
|
||||
});
|
||||
|
||||
})->export('xls');
|
||||
|
||||
### Null comparision
|
||||
|
||||
By default 0 is shown as an empty cell. If you want to change this behaviour, you can pass true as 4th parameter:
|
||||
|
||||
// Will show 0 as 0
|
||||
$sheet->fromArray($data, null, 'A1', true);
|
||||
|
||||
>> To change the default behaviour, you can use `excel::export.sheets.strictNullComparison` config setting.
|
||||
|
||||
## Eloquent model
|
||||
|
||||
It's also possible to pass an Eloquent model and export it by using `->fromModel($model)`. The method accepts the same parameters as fromArray
|
||||
|
||||
## Auto heading generation
|
||||
|
||||
By default the export will use the keys of your array (or model attribute names) as first row (header column). To change this behaviour you can edit the default config setting (`excel::export.generate_heading_by_indices`) or pass `false` as 5th parameter:
|
||||
|
||||
// Won't auto generate heading columns
|
||||
$sheet->fromArray($data, null, 'A1', false, false);
|
||||
9
vendor/maatwebsite/excel/docs/export/autofilter.md
vendored
Normal file
9
vendor/maatwebsite/excel/docs/export/autofilter.md
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
# Auto filter
|
||||
|
||||
To enable the auto filter use `->setAutoFilter($range = false)`.
|
||||
|
||||
// Auto filter for entire sheet
|
||||
$sheet->setAutoFilter();
|
||||
|
||||
// Set auto filter for a range
|
||||
$sheet->setAutoFilter('A1:E10');
|
||||
16
vendor/maatwebsite/excel/docs/export/autosize.md
vendored
Normal file
16
vendor/maatwebsite/excel/docs/export/autosize.md
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
# Auto size
|
||||
|
||||
By default the exported file be automatically auto sized. To change this behaviour you can either change the config or use the setters:
|
||||
|
||||
// Set auto size for sheet
|
||||
$sheet->setAutoSize(true);
|
||||
|
||||
// Disable auto size for sheet
|
||||
$sheet->setAutoSize(false);
|
||||
|
||||
// Disable auto size for columns
|
||||
$sheet->setAutoSize(array(
|
||||
'A', 'C'
|
||||
));
|
||||
|
||||
> The default config setting can be found in: `export.php`.
|
||||
19
vendor/maatwebsite/excel/docs/export/call.md
vendored
Normal file
19
vendor/maatwebsite/excel/docs/export/call.md
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
# Calling PHPExcel's native methods
|
||||
|
||||
It's possible to call all native PHPExcel methods on the `$excel` and `$sheet` objects.
|
||||
|
||||
### Calling Workbook methods
|
||||
|
||||
Example:
|
||||
|
||||
// Get default style for this workbook
|
||||
$excel->getDefaultStyle();
|
||||
|
||||
### Calling worksheet methods
|
||||
|
||||
Example:
|
||||
|
||||
// Protect cells
|
||||
$sheet->protectCells('A1', $password);
|
||||
|
||||
> Head over to PHPOffice to learn more about the native methods.
|
||||
65
vendor/maatwebsite/excel/docs/export/cells.md
vendored
Normal file
65
vendor/maatwebsite/excel/docs/export/cells.md
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
# Cell manipulation
|
||||
|
||||
$sheet->cell('A1', function($cell) {
|
||||
|
||||
// manipulate the cell
|
||||
|
||||
});
|
||||
|
||||
$sheet->cells('A1:A5', function($cells) {
|
||||
|
||||
// manipulate the range of cells
|
||||
|
||||
});
|
||||
|
||||
### Set background
|
||||
|
||||
To change the background of a range of cells we can use `->setBackground($color, $type, $colorType)`
|
||||
|
||||
// Set black background
|
||||
$cells->setBackground('#000000');
|
||||
|
||||
### Change fonts
|
||||
|
||||
// Set with font color
|
||||
$cells->setFontColor('#ffffff');
|
||||
|
||||
// Set font family
|
||||
$cells->setFontFamily('Calibri');
|
||||
|
||||
// Set font size
|
||||
$cells->setFontSize(16);
|
||||
|
||||
// Set font weight to bold
|
||||
$cells->setFontWeight('bold');
|
||||
|
||||
// Set font
|
||||
$cells->setFont(array(
|
||||
'family' => 'Calibri',
|
||||
'size' => '16',
|
||||
'bold' => true
|
||||
));
|
||||
|
||||
### Set borders
|
||||
|
||||
// Set all borders (top, right, bottom, left)
|
||||
$cells->setBorder('solid', 'none', 'none', 'solid');
|
||||
|
||||
// Set borders with array
|
||||
$cells->setBorder(array(
|
||||
'borders' => array(
|
||||
'top' => array(
|
||||
'style' => 'solid'
|
||||
),
|
||||
)
|
||||
));
|
||||
|
||||
### Set horizontal alignment
|
||||
|
||||
// Set alignment to center
|
||||
$cells->setAlignment('center');
|
||||
|
||||
### Set vertical alignment
|
||||
|
||||
// Set vertical alignment to middle
|
||||
$cells->setValignment('middle');
|
||||
28
vendor/maatwebsite/excel/docs/export/export.md
vendored
Normal file
28
vendor/maatwebsite/excel/docs/export/export.md
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
# Exporting
|
||||
|
||||
To download the created file, use `->export($ext)` or `->download($ext)`.
|
||||
|
||||
#### Export to Excel5 (xls)
|
||||
|
||||
Excel::create('Filename', function($excel) {
|
||||
|
||||
})->export('xls');
|
||||
|
||||
// or
|
||||
->download('xls');
|
||||
|
||||
#### Export to Excel2007 (xlsx)
|
||||
|
||||
->export('xlsx');
|
||||
|
||||
// or
|
||||
->download('xlsx');
|
||||
|
||||
#### Export to CSV
|
||||
|
||||
->export('csv');
|
||||
|
||||
// or
|
||||
->download('csv');
|
||||
|
||||
> You can set the default enclosure and delimiter inside the config
|
||||
23
vendor/maatwebsite/excel/docs/export/format.md
vendored
Normal file
23
vendor/maatwebsite/excel/docs/export/format.md
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
# Column formatting
|
||||
|
||||
To tell Excel how it should interpret certain columns, you can use `->setColumnFormat($array)`.
|
||||
|
||||
// Format column as percentage
|
||||
$sheet->setColumnFormat(array(
|
||||
'C' => '0%'
|
||||
));
|
||||
|
||||
// Format a range with e.g. leading zeros
|
||||
$sheet->setColumnFormat(array(
|
||||
'A2:K2' => '0000'
|
||||
));
|
||||
|
||||
// Set multiple column formats
|
||||
$sheet->setColumnFormat(array(
|
||||
'B' => '0',
|
||||
'D' => '0.00',
|
||||
'F' => '@',
|
||||
'F' => 'yyyy-mm-dd',
|
||||
));
|
||||
|
||||
> Go to the reference guide to see a list of available formats.
|
||||
15
vendor/maatwebsite/excel/docs/export/freeze.md
vendored
Normal file
15
vendor/maatwebsite/excel/docs/export/freeze.md
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
# Freeze rows
|
||||
|
||||
If you want to freeze a cell, row or column, use:
|
||||
|
||||
// Freeze first row
|
||||
$sheet->freezeFirstRow();
|
||||
|
||||
// Freeze the first column
|
||||
$sheet->freezeFirstColumn();
|
||||
|
||||
// Freeze the first row and column
|
||||
$sheet->freezeFirstRowAndColumn();
|
||||
|
||||
// Set freeze
|
||||
$sheet->setFreeze('A2');
|
||||
19
vendor/maatwebsite/excel/docs/export/merge.md
vendored
Normal file
19
vendor/maatwebsite/excel/docs/export/merge.md
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
# Column merging
|
||||
|
||||
### Merging cells
|
||||
|
||||
To merge a range of cells, use `->mergeCells($range)`.
|
||||
|
||||
$sheet->mergeCells('A1:E1');
|
||||
|
||||
### Merging columns and rows
|
||||
|
||||
To merge columns and rows, use `->setMergeColumn($array)`.
|
||||
|
||||
$sheet->setMergeColumn(array(
|
||||
'columns' => array('A','B','C','D'),
|
||||
'rows' => array(
|
||||
array(2,3),
|
||||
array(5,11),
|
||||
)
|
||||
));
|
||||
63
vendor/maatwebsite/excel/docs/export/rows.md
vendored
Normal file
63
vendor/maatwebsite/excel/docs/export/rows.md
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
# Row manipulation
|
||||
|
||||
### Manipulate certain row
|
||||
|
||||
#### Change cell values
|
||||
|
||||
// Manipulate first row
|
||||
$sheet->row(1, array(
|
||||
'test1', 'test2'
|
||||
));
|
||||
|
||||
// Manipulate 2nd row
|
||||
$sheet->row(2, array(
|
||||
'test3', 'test4'
|
||||
));
|
||||
|
||||
#### Manipulate row cells
|
||||
|
||||
// Set black background
|
||||
$sheet->row(1, function($row) {
|
||||
|
||||
// call cell manipulation methods
|
||||
$row->setBackground('#000000');
|
||||
|
||||
});
|
||||
|
||||
### Append row
|
||||
|
||||
// Append row after row 2
|
||||
$sheet->appendRow(2, array(
|
||||
'appended', 'appended'
|
||||
));
|
||||
|
||||
// Append row as very last
|
||||
$sheet->appendRow(array(
|
||||
'appended', 'appended'
|
||||
));
|
||||
|
||||
### Prepend row
|
||||
|
||||
// Add before first row
|
||||
$sheet->prependRow(1, array(
|
||||
'prepended', 'prepended'
|
||||
));
|
||||
|
||||
// Add as very first
|
||||
$sheet->prependRow(array(
|
||||
'prepended', 'prepended'
|
||||
));
|
||||
|
||||
### Append multiple rows
|
||||
|
||||
// Append multiple rows
|
||||
$sheet->rows(array(
|
||||
array('test1', 'test2'),
|
||||
array('test3', 'test4')
|
||||
));
|
||||
|
||||
// Append multiple rows
|
||||
$sheet->rows(array(
|
||||
array('test5', 'test6'),
|
||||
array('test7', 'test8')
|
||||
));
|
||||
50
vendor/maatwebsite/excel/docs/export/sheet-styling.md
vendored
Normal file
50
vendor/maatwebsite/excel/docs/export/sheet-styling.md
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
# Sheet styling
|
||||
|
||||
### General styling
|
||||
|
||||
If you want to change the general styling of your sheet (not cell or range specific), you can use the `->setStyle()` method.
|
||||
|
||||
// Set font with ->setStyle()`
|
||||
$sheet->setStyle(array(
|
||||
'font' => array(
|
||||
'name' => 'Calibri',
|
||||
'size' => 15,
|
||||
'bold' => true
|
||||
)
|
||||
));
|
||||
|
||||
### Fonts
|
||||
|
||||
To change the font for the current sheet use `->setFont($array)`:
|
||||
|
||||
$sheet->setFont(array(
|
||||
'family' => 'Calibri',
|
||||
'size' => '15',
|
||||
'bold' => true
|
||||
));
|
||||
|
||||
#### Separate setters
|
||||
|
||||
// Font family
|
||||
$sheet->setFontFamily('Comic Sans MS');
|
||||
|
||||
// Font size
|
||||
$sheet->setFontSize(15);
|
||||
|
||||
// Font bold
|
||||
$sheet->setFontBold(true);
|
||||
|
||||
### Borders
|
||||
|
||||
You can set borders for the sheet, by using:
|
||||
|
||||
// Sets all borders
|
||||
$sheet->setAllBorders('thin');
|
||||
|
||||
// Set border for cells
|
||||
$sheet->setBorder('A1', 'thin');
|
||||
|
||||
// Set border for range
|
||||
$sheet->setBorder('A1:F10', 'thin');
|
||||
|
||||
> Go to the reference guide to see a list of available border styles
|
||||
65
vendor/maatwebsite/excel/docs/export/sheets.md
vendored
Normal file
65
vendor/maatwebsite/excel/docs/export/sheets.md
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
# Sheets
|
||||
|
||||
### Creating a sheet
|
||||
|
||||
To create a new sheet inside our newly created file, use `->sheet('Sheetname')`.
|
||||
|
||||
Excel::create('Filename', function($excel) {
|
||||
|
||||
$excel->sheet('Sheetname', function($sheet) {
|
||||
|
||||
// Sheet manipulation
|
||||
|
||||
});
|
||||
|
||||
})->export('xls');
|
||||
|
||||
|
||||
### Creating multiple sheets
|
||||
|
||||
You can set as many sheets as you like inside the file:
|
||||
|
||||
Excel::create('Filename', function($excel) {
|
||||
|
||||
// Our first sheet
|
||||
$excel->sheet('First sheet', function($sheet) {
|
||||
|
||||
});
|
||||
|
||||
// Our second sheet
|
||||
$excel->sheet('Second sheet', function($sheet) {
|
||||
|
||||
});
|
||||
|
||||
})->export('xls');
|
||||
|
||||
### Changing properties
|
||||
|
||||
There are a couple of properties we can change inside the closure. Most of them are set to the config values by default. See `app/config/packages/maatwebsite/excel/config.php`.
|
||||
|
||||
Excel::create('Filename', function($excel) {
|
||||
|
||||
$excel->sheet('Sheetname', function($sheet) {
|
||||
|
||||
$sheet->setOrientation('landscape');
|
||||
|
||||
});
|
||||
|
||||
})->export('xls');
|
||||
|
||||
> Go to the reference guide to see a list of available properties.
|
||||
|
||||
### Default page margin
|
||||
|
||||
It's possible to set the default page margin insde the config file `excel::export.sheets`.
|
||||
It accepts boolean, single value or array.
|
||||
|
||||
To manually set the page margin you can use: `->setPageMargin()`
|
||||
|
||||
// Set top, right, bottom, left
|
||||
$sheet->setPageMargin(array(
|
||||
0.25, 0.30, 0.25, 0.30
|
||||
));
|
||||
|
||||
// Set all margins
|
||||
$sheet->setPageMargin(0.25);
|
||||
35
vendor/maatwebsite/excel/docs/export/simple.md
vendored
Normal file
35
vendor/maatwebsite/excel/docs/export/simple.md
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
# Simple Excel Export
|
||||
|
||||
### Basics
|
||||
|
||||
A new file can be created using the `create` method with the filename as first parameter.
|
||||
|
||||
Excel::create('Filename');
|
||||
|
||||
To manipulate the creation of the file you can use the callback
|
||||
|
||||
Excel::create('Filename', function($excel) {
|
||||
|
||||
// Call writer methods here
|
||||
|
||||
});
|
||||
|
||||
### Changing properties
|
||||
|
||||
There are a couple of properties we can change inside the closure. Most of them are set to the config values by default. See `app/config/packages/maatwebsite/excel/config.php`.
|
||||
|
||||
Excel::create('Filename', function($excel) {
|
||||
|
||||
// Set the title
|
||||
$excel->setTitle('Our new awesome title');
|
||||
|
||||
// Chain the setters
|
||||
$excel->setCreator('Maatwebsite')
|
||||
->setCompany('Maatwebsite');
|
||||
|
||||
// Call them separately
|
||||
$excel->setDescription('A demonstration to change the file properties');
|
||||
|
||||
});
|
||||
|
||||
> Go to the reference guide to see a list of available properties.
|
||||
41
vendor/maatwebsite/excel/docs/export/sizing.md
vendored
Normal file
41
vendor/maatwebsite/excel/docs/export/sizing.md
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
# Cell size
|
||||
|
||||
### Set column width
|
||||
|
||||
To set the column width use `->setWidth($cell, $width)`.
|
||||
|
||||
// Set width for a single column
|
||||
$sheet->setWidth('A', 5);
|
||||
|
||||
// Set width for multiple cells
|
||||
$sheet->setWidth(array(
|
||||
'A' => 5,
|
||||
'B' => 10
|
||||
));
|
||||
|
||||
### Set row height
|
||||
|
||||
To set the row height use `->setHeight($row, $height)`.
|
||||
|
||||
// Set height for a single row
|
||||
$sheet->setHeight(1, 50);
|
||||
|
||||
// Set height for multiple rows
|
||||
$sheet->setHeight(array(
|
||||
1 => 50,
|
||||
2 => 25
|
||||
));
|
||||
|
||||
### Set cell size
|
||||
|
||||
To set the cell size use `->setSize($cell, $width, $height)`.
|
||||
|
||||
// Set size for a single cell
|
||||
$sheet->setSize('A1', 500, 50);
|
||||
|
||||
$sheet->setSize(array(
|
||||
'A1' => array(
|
||||
'width' => 50
|
||||
'height' => 500,
|
||||
)
|
||||
));
|
||||
39
vendor/maatwebsite/excel/docs/export/store.md
vendored
Normal file
39
vendor/maatwebsite/excel/docs/export/store.md
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
# Store on server
|
||||
|
||||
To store the created file on the server, use `->store($ext, $path = false, $returnInfo = false)` or `->save()`.
|
||||
|
||||
### Normal export to default storage path
|
||||
|
||||
By default the file will be stored inside the `app/storage/exports` folder, which has been defined in the `export.php` config file.
|
||||
|
||||
Excel::create('Filename', function($excel) {
|
||||
|
||||
// Set sheets
|
||||
|
||||
})->store('xls');
|
||||
|
||||
### Normal export to custom storage path
|
||||
|
||||
If you want to use a custom storage path (e.g. to separate the files per client), you can set the folder as the second parameter.
|
||||
|
||||
->store('xls', storage_path('excel/exports'));
|
||||
|
||||
### Store and export
|
||||
|
||||
->store('xls')->export('xls');
|
||||
|
||||
### Store and return storage info
|
||||
|
||||
If you want to return storage information, set the third paramter to true or change the config setting inside `export.php`.
|
||||
|
||||
->store('xls', false, true);
|
||||
|
||||
|Key|Explanation|
|
||||
|---|-----------|
|
||||
|**full**| Full path with filename
|
||||
|**path**| Path without filename
|
||||
|**file**| Filename
|
||||
|**title**| File title
|
||||
|**ext**| File extension
|
||||
|
||||
> Make sure your storage folder is **writable**!
|
||||
42
vendor/maatwebsite/excel/docs/formats.md
vendored
Normal file
42
vendor/maatwebsite/excel/docs/formats.md
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
PHPExcel_Style_NumberFormat::FORMAT_GENERAL = 'General'
|
||||
PHPExcel_Style_NumberFormat::FORMAT_TEXT = '@'
|
||||
PHPExcel_Style_NumberFormat::FORMAT_NUMBER = '0'
|
||||
PHPExcel_Style_NumberFormat::FORMAT_NUMBER_00 = '0.00'
|
||||
PHPExcel_Style_NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1 = '#,##0.00'
|
||||
PHPExcel_Style_NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED2 = '#,##0.00_-'
|
||||
PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE = '0%'
|
||||
PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE_00 = '0.00%'
|
||||
PHPExcel_Style_NumberFormat::FORMAT_DATE_YYYYMMDD2 = 'yyyy-mm-dd'
|
||||
PHPExcel_Style_NumberFormat::FORMAT_DATE_YYYYMMDD = 'yy-mm-dd'
|
||||
PHPExcel_Style_NumberFormat::FORMAT_DATE_DDMMYYYY = 'dd/mm/yy'
|
||||
PHPExcel_Style_NumberFormat::FORMAT_DATE_DMYSLASH = 'd/m/y'
|
||||
PHPExcel_Style_NumberFormat::FORMAT_DATE_DMYMINUS = 'd-m-y'
|
||||
PHPExcel_Style_NumberFormat::FORMAT_DATE_DMMINUS = 'd-m'
|
||||
PHPExcel_Style_NumberFormat::FORMAT_DATE_MYMINUS = 'm-y'
|
||||
PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX14 = 'mm-dd-yy'
|
||||
PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX15 = 'd-mmm-yy'
|
||||
PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX16 = 'd-mmm'
|
||||
PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX17 = 'mmm-yy'
|
||||
PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX22 = 'm/d/yy h:mm'
|
||||
PHPExcel_Style_NumberFormat::FORMAT_DATE_DATETIME = 'd/m/y h:mm'
|
||||
PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME1 = 'h:mm AM/PM'
|
||||
PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME2 = 'h:mm:ss AM/PM'
|
||||
PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME3 = 'h:mm'
|
||||
PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME4 = 'h:mm:ss'
|
||||
PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME5 = 'mm:ss'
|
||||
PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME6 = 'h:mm:ss'
|
||||
PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME7 = 'i:s.S'
|
||||
PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME8 = 'h:mm:ss;@'
|
||||
PHPExcel_Style_NumberFormat::FORMAT_DATE_YYYYMMDDSLASH = 'yy/mm/dd;@'
|
||||
PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE = '"$"#,##0.00_-'
|
||||
PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD = '$#,##0_-'
|
||||
PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE = '[$EUR ]#,##0.00_-'
|
||||
|
||||
->setColumnFormat(array(
|
||||
'B' => '0',
|
||||
'D' => '0.00',
|
||||
'F' => '@',
|
||||
'F' => 'yyyy-mm-dd',
|
||||
......
|
||||
)
|
||||
)
|
||||
5
vendor/maatwebsite/excel/docs/getting-started.md
vendored
Normal file
5
vendor/maatwebsite/excel/docs/getting-started.md
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
@include:Installation|installation
|
||||
@include:Config|config
|
||||
@include:Requirements|requirements
|
||||
@include:Contributing|contributing
|
||||
@include:License|license
|
||||
8
vendor/maatwebsite/excel/docs/getting-started/config.md
vendored
Normal file
8
vendor/maatwebsite/excel/docs/getting-started/config.md
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
#Config
|
||||
|
||||
Laravel Excel includes several config settings for import-, export-, view- and CSV-specific settings.
|
||||
Use the artisan publish command to publish the config file to your project.
|
||||
|
||||
php artisan config:publish maatwebsite/excel
|
||||
|
||||
The config files can now be found at `app/config/packages/maatwebsite/excel`
|
||||
22
vendor/maatwebsite/excel/docs/getting-started/contributing.md
vendored
Normal file
22
vendor/maatwebsite/excel/docs/getting-started/contributing.md
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
# Contribution Guide
|
||||
|
||||
### Bug fixes
|
||||
|
||||
**ALL** bug fixes should be made to appropriate branch (e.g. `1.1` for 1.1.* bug fixes). Bug fixes should never be sent to the `master` branch.
|
||||
|
||||
### Pull Requests
|
||||
|
||||
Every pull request should pass the unit tests. If you include new functionality, make sure you include a test. Pull requests will be evaluated and possibly added to the next stable release.
|
||||
|
||||
### Feature Requests
|
||||
|
||||
If you have an idea for a new feature you would like to see added to Laravel Excel, you may create an issue on GitHub with `[Request]` in the title. The feature request will then be reviewed by @Maatwebsite.
|
||||
|
||||
### Coding Guidelines
|
||||
|
||||
Laravel, and therefore Maatwebsite's Laravel Excel follows the [PSR-0](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md) and [PSR-1](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md) coding standards. In addition to these standards, below is a list of other coding standards that should be followed:
|
||||
|
||||
- Namespace declarations should be on the same line as `<?php`.
|
||||
- Class opening `{` should be on the same line as the class name.
|
||||
- Function and control structure opening `{` should be on a separate line.
|
||||
- Interface and Trait names are suffixed with `Interface` (`FooInterface`) and `Trait` (`FooTrait`) respectively.
|
||||
17
vendor/maatwebsite/excel/docs/getting-started/installation.md
vendored
Normal file
17
vendor/maatwebsite/excel/docs/getting-started/installation.md
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
#Installation
|
||||
|
||||
Require this package in your `composer.json` and update composer. This will download the package and PHPExcel of PHPOffice.
|
||||
|
||||
"maatwebsite/excel": "1.*"
|
||||
|
||||
After updating composer, add the ServiceProvider to the providers array in `app/config/app.php`
|
||||
|
||||
'Maatwebsite\Excel\ExcelServiceProvider',
|
||||
|
||||
You can use the facade for shorter code. Add this to your aliasses:
|
||||
|
||||
'Excel' => 'Maatwebsite\Excel\Facades\Excel',
|
||||
|
||||
The class is binded to the ioC as `excel`
|
||||
|
||||
$excel = App::make('excel');
|
||||
3
vendor/maatwebsite/excel/docs/getting-started/license.md
vendored
Normal file
3
vendor/maatwebsite/excel/docs/getting-started/license.md
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
#License
|
||||
|
||||
This package is licensed under LGPL. You are free to use it in personal and commercial projects. The code can be forked and modified, but the original copyright author should always be included!
|
||||
8
vendor/maatwebsite/excel/docs/getting-started/requirements.md
vendored
Normal file
8
vendor/maatwebsite/excel/docs/getting-started/requirements.md
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
# Requirements
|
||||
|
||||
- PHP version >= 5.3.7
|
||||
- Laravel >= 4.1
|
||||
- PHPOffice PHPExcel >= 1.8.0 (included by composer.json)
|
||||
- PHP extension php_zip enabled (required if you need PHPExcel to handle .xlsx .ods or .gnumeric files)
|
||||
- PHP extension php_xml enabled
|
||||
- PHP extension php_gd2 enabled (optional, but required for exact column width autocalculation)
|
||||
9
vendor/maatwebsite/excel/docs/import.md
vendored
Normal file
9
vendor/maatwebsite/excel/docs/import.md
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
@include:Importing a file|basics
|
||||
@include:Handling results|results
|
||||
@include:Selecting sheets and columns|select
|
||||
@include:Dates|dates
|
||||
@include:Calculation|calculation
|
||||
@include:Caching and cell caching|cache
|
||||
@include:Batch import|batch
|
||||
@include:Import by config|config
|
||||
@include:Extra|extra
|
||||
9
vendor/maatwebsite/excel/docs/import/basics.md
vendored
Normal file
9
vendor/maatwebsite/excel/docs/import/basics.md
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
# Importing a file
|
||||
|
||||
To start importing a file, you can use `->load($filename)`. The callback is optional.
|
||||
|
||||
Excel::load('file.xls', function($reader) {
|
||||
|
||||
// reader methods
|
||||
|
||||
});
|
||||
43
vendor/maatwebsite/excel/docs/import/batch.md
vendored
Normal file
43
vendor/maatwebsite/excel/docs/import/batch.md
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
#Batch import
|
||||
|
||||
### Import a folder
|
||||
|
||||
To import an entire folder (only xls, xlsx and csv files will be imported), set the folder as the first parameter.
|
||||
|
||||
Excel::batch('app/storage/uploads', function($rows, $file) {
|
||||
|
||||
// Explain the reader how it should interpret each row,
|
||||
// for every file inside the batch
|
||||
$rows->each(function($row) {
|
||||
|
||||
// Example: dump the firstname
|
||||
dd($row->firstname);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
### Import multiple files
|
||||
|
||||
It's also possible to provide an array of files to import.
|
||||
|
||||
$files = array(
|
||||
'file1.xls',
|
||||
'file2.xls'
|
||||
);
|
||||
|
||||
Excel::batch($files, function($rows, $file) {
|
||||
|
||||
});
|
||||
|
||||
### Import a folder and multiple sheets
|
||||
|
||||
When your files contain multiple sheets, you should also loop the sheets
|
||||
|
||||
Excel::batch('app/storage/uploads', function($sheets, $file) {
|
||||
|
||||
$sheets->each(function($sheet) {
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
12
vendor/maatwebsite/excel/docs/import/cache.md
vendored
Normal file
12
vendor/maatwebsite/excel/docs/import/cache.md
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
# Caching and Cell caching
|
||||
|
||||
### Cell caching
|
||||
|
||||
You can enable cell caching inside the config `cache.php`. You can choose between a couple of drivers and change a couple of settings. By default the caching is **enabled** and will use **in memory** caching.
|
||||
|
||||
### Remembering results
|
||||
|
||||
If you want to remember the results you can use `->remember($minutes)`. Next time you will load the same file (if it's still inside the cache), it will return the cached results.
|
||||
|
||||
// Remember for 10 minutes
|
||||
$results = $reader->remember(10)->get();
|
||||
11
vendor/maatwebsite/excel/docs/import/calculation.md
vendored
Normal file
11
vendor/maatwebsite/excel/docs/import/calculation.md
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
# Calculate formulas
|
||||
|
||||
By default formulas inside the file are being calculated and it's result will be returned. Inside `import.php` config you can change the default behaviour by setting `calculate` to the desired preference.
|
||||
|
||||
If you want to enable/disable it for a single import, you can use `->calculate($boolean)`
|
||||
|
||||
// Enable calculation
|
||||
$reader->calculate();
|
||||
|
||||
// Disable calculation
|
||||
$reader->calculate(false);
|
||||
15
vendor/maatwebsite/excel/docs/import/config.md
vendored
Normal file
15
vendor/maatwebsite/excel/docs/import/config.md
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
# Import by Config
|
||||
|
||||
When using advanced Excel files (e.g. without any heading columns), it can be complicated to import these.
|
||||
`->byConfig()` will help you handle this problem.
|
||||
|
||||
Inside `excel::import.sheets` config you can find an example.
|
||||
|
||||
Excel::load('file.xls')->byConfig('excel::import.sheets', function($sheet) {
|
||||
|
||||
// The firstname getter will correspond with a cell coordinate set inside the config
|
||||
$firstname = $sheet->firstname;
|
||||
|
||||
});
|
||||
|
||||
> **Note:** if you are using multiple sheets. `->byConfig` will loop through all sheets. If these getters are only exist on one sheet, you can always use `->selectSheets()`.
|
||||
45
vendor/maatwebsite/excel/docs/import/dates.md
vendored
Normal file
45
vendor/maatwebsite/excel/docs/import/dates.md
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
# Dates
|
||||
|
||||
By default the dates will be parsed as a **[Carbon object](https://github.com/briannesbitt/Carbon)**. You can disable date formatting completly inside `import.php` by setting `dates.enabled` to `false`.
|
||||
|
||||
To enable/disable date formatting for a single import, use `->formatDates($boolean, $format)`
|
||||
|
||||
// Format the dates
|
||||
$reader->formatDates(true);
|
||||
|
||||
// Disable date formatting
|
||||
$reader->formatDates(false);
|
||||
|
||||
// Format dates + set date format
|
||||
$reader->formatDates(true, 'Y-m-d');
|
||||
|
||||
### Format dates
|
||||
|
||||
By default the dates are **not formatted**, but returned as a Carbon object. There are a couple of options to format them.
|
||||
|
||||
#### Formatting results after ->get()
|
||||
|
||||
Inside your loop you can utilise the Carbon method `->format($dateFormat)`
|
||||
|
||||
$rows->each(function($row) {
|
||||
|
||||
$created_at = $row->created_at->format('Y-m-d');
|
||||
|
||||
});
|
||||
|
||||
#### Setting a default date format
|
||||
|
||||
Inside the config you can set a default date format. A Carbon object will no longer be returned.
|
||||
|
||||
Or you can use `->setDateFormat()`
|
||||
|
||||
$reader->setDateFormat('Y-m-d');
|
||||
|
||||
### Setting custom date columns
|
||||
|
||||
Cells which are not Excel formatted dates will not be parsed as a date. To force this behaviour (or to use this with CSV imports), you can set these date columns manually: `->setDateColumns()`
|
||||
|
||||
$reader->setDateColumns(array(
|
||||
'created_at',
|
||||
'deleted_at'
|
||||
))->get();
|
||||
44
vendor/maatwebsite/excel/docs/import/extra.md
vendored
Normal file
44
vendor/maatwebsite/excel/docs/import/extra.md
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
# Extra
|
||||
|
||||
### Disable using first row as collection attributes
|
||||
|
||||
By default we will use the first row of a file as table heading (so as attribute names for the collection).
|
||||
You can change the default behaviour inside `import.php` with `import.heading`.
|
||||
|
||||
To disable this for a single import, use `->noHeading()`.
|
||||
|
||||
$reader->noHeading();
|
||||
|
||||
### Setting the cell name separator
|
||||
By default collection attribute names will be set by looking at the first row columns. Spaces will be translated to `_`.
|
||||
|
||||
**E.g. Created at -> created_at**
|
||||
|
||||
The default behaviour can be changed inside the `import.php` config by changing `'separator'`. Or you can use `->setSeparator($separator)`.
|
||||
|
||||
$reader->setSeparator('-');
|
||||
|
||||
### Ignoring empty cells
|
||||
By default empty cells will not be ignored and presented as null inside the cell collection.
|
||||
|
||||
To change the default behaviour, you can change `'ignoreEmpty`' inside `import.php` or use `->ignoreEmpty()`.
|
||||
|
||||
$reader->ignoreEmpty();
|
||||
|
||||
### Input encoding
|
||||
|
||||
Inside the `import.php` config you can change the input encoding. In most cases **UTF-8** will be the best solution. Hower if you dump your results make sure your HTML page has this exact same meta charset!
|
||||
|
||||
Optionally you can pass the input encoding inside the `->load()` method.
|
||||
|
||||
// When utilising a closure, you can pass the input encoding as third parameter.
|
||||
Excel::load('filename.csv', function($reader) {
|
||||
|
||||
}, 'UTF-8');
|
||||
|
||||
// or without a closure, you can use it as second parameter.
|
||||
Excel::load('filename.csv', 'UTF-8');
|
||||
|
||||
### CSV Settings
|
||||
|
||||
Inside the `csv.php` config you can change the default settings, like the `delimiter`, the `enclosure` and the `line_ending`.
|
||||
126
vendor/maatwebsite/excel/docs/import/results.md
vendored
Normal file
126
vendor/maatwebsite/excel/docs/import/results.md
vendored
Normal file
@@ -0,0 +1,126 @@
|
||||
# Handling imported results
|
||||
|
||||
### Getting all sheets and rows
|
||||
|
||||
After you have loaded a file, you can `->get()` the results like so:
|
||||
|
||||
Excel::load('file.xls', function($reader) {
|
||||
|
||||
})->get();
|
||||
|
||||
or
|
||||
|
||||
Excel::load('file.xls', function($reader) {
|
||||
|
||||
// Getting all results
|
||||
$results = $reader->get();
|
||||
|
||||
// ->all() is a wrapper for ->get() and will work the same
|
||||
$results = $reader->all();
|
||||
|
||||
});
|
||||
|
||||
> The `->get()` and `->all()` methods will return a sheet or row collection, depending on the amount of sheets the file has. You can disable this feature inside the `import.php` config by setting `'force_sheets_collection'` to `true`. When set to true it will always return a sheet collection.
|
||||
|
||||
### Table heading as attributes
|
||||
|
||||
By default the first row of the excel file will be used as attributes.
|
||||
|
||||
// Get the firstname
|
||||
$row->firstname;
|
||||
|
||||
> **Note**: by default these attributes will be converted to a slug. You can change the default inside the config `excel::import.heading`. Available options are: `true|false|slugged|ascii|numeric|hashed|trans|original`
|
||||
|
||||
> True and slugged will be converted to ASCII as well when `excel::import.to_ascii` is set to true. You can change the default separator as well inside the config.
|
||||
|
||||
### Collections
|
||||
|
||||
Sheets, rows and cells are collections, this means after doing a `->get()` you can use all default collection methods.
|
||||
|
||||
// E.g. group the results
|
||||
$reader->get()->groupBy('firstname');
|
||||
|
||||
### Getting the first sheet or row
|
||||
|
||||
To get the first sheet or row, you can utilise `->first()`.
|
||||
|
||||
$reader->first();
|
||||
|
||||
> **Note:** depending on the config `'force_sheets_collection'` it will return the first row or sheet.
|
||||
|
||||
### Workbook and sheet title
|
||||
|
||||
It's possible to retrieve the workbook and sheet title with `->getTitle()`.
|
||||
|
||||
// Get workbook title
|
||||
$workbookTitle = $reader->getTitle();
|
||||
|
||||
foreach($reader as $sheet)
|
||||
{
|
||||
// get sheet title
|
||||
$sheetTitle = $sheet->getTitle();
|
||||
}
|
||||
|
||||
### Limiting the results
|
||||
|
||||
##### Taking rows
|
||||
|
||||
When you only want to return the first x rows of a sheet, you can use `->take()` or `->limit()`.
|
||||
|
||||
// You can either use ->take()
|
||||
$reader->take(10);
|
||||
|
||||
// Or ->limit()
|
||||
$reader->limit(10);
|
||||
|
||||
##### Skipping rows
|
||||
|
||||
When you want to skip a certain amount of rows you can use `->skip()` or `->limit(false, 10)`
|
||||
|
||||
// Skip 10 results
|
||||
$reader->skip(10);
|
||||
|
||||
// Skip 10 results with limit, but return all other rows
|
||||
$reader->limit(false, 10);
|
||||
|
||||
// Skip and take
|
||||
$reader->skip(10)->take(10);
|
||||
|
||||
// Limit with skip and take
|
||||
$reader->($skip, $take);
|
||||
|
||||
### Result mutators
|
||||
|
||||
When you want to get an array instead of an object, you can use `->toArray()`.
|
||||
|
||||
$reader->toArray();
|
||||
|
||||
When you want an object, you can alternativly (instead of get() or all()) use `->toObject()`.
|
||||
|
||||
$reader->toObject();
|
||||
|
||||
### Displaying results
|
||||
|
||||
You can dump the results to a readable output by using `->dump()` or `->dd()`.
|
||||
|
||||
// Dump the results
|
||||
$reader->dump();
|
||||
|
||||
// Dump results and die
|
||||
$reader->dd();
|
||||
|
||||
### Iterating the results
|
||||
|
||||
You can iterate the results by using `->each()`.
|
||||
|
||||
// Loop through all sheets
|
||||
$reader->each(function($sheet) {
|
||||
|
||||
// Loop through all rows
|
||||
$sheet->each(function($row) {
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
> Alternatively you can also `foreach` the results.
|
||||
31
vendor/maatwebsite/excel/docs/import/select.md
vendored
Normal file
31
vendor/maatwebsite/excel/docs/import/select.md
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
# Selecting sheets and columns
|
||||
|
||||
### Selecting one specific sheet
|
||||
If you want to select a single sheet, you can use `->selectSheets($name)`. Only that sheet will be loaded.
|
||||
|
||||
Excel::selectSheets('sheet1')->load();
|
||||
|
||||
### Selecting multiple sheets
|
||||
If you want to select multiple sheets inside your file, you can pass an array as the parameter;
|
||||
|
||||
Excel::selectSheets('sheet1', 'sheet2')->load();
|
||||
|
||||
### Selecting sheets by index
|
||||
|
||||
// First sheet
|
||||
Excel::selectSheetsByIndex(0)->load();
|
||||
|
||||
// First and second sheet
|
||||
Excel::selectSheetsByIndex(0, 1)->load();
|
||||
|
||||
### Selecting columns
|
||||
|
||||
If you want to select only a couple of columns, you can use `->select($columns)` or pass an array as the first parameter of `->get($columns)`.
|
||||
|
||||
// Select
|
||||
$reader->select(array('firstname', 'lastname'))->get();
|
||||
|
||||
// Or
|
||||
$reader->get(array('firstname', 'lastname'));
|
||||
|
||||
> All get methods (like all(), first(), dump(), toArray(), ...) accept an array of columns.
|
||||
8
vendor/maatwebsite/excel/docs/merge.md
vendored
Normal file
8
vendor/maatwebsite/excel/docs/merge.md
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
$mergeColumn = array(
|
||||
* 'columns' => array('A','B','C','D'),
|
||||
* 'rows' => array(
|
||||
* array(2,3),
|
||||
* array(5,11),
|
||||
* .....
|
||||
* )
|
||||
* );
|
||||
6
vendor/maatwebsite/excel/docs/reference-guide.md
vendored
Normal file
6
vendor/maatwebsite/excel/docs/reference-guide.md
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
@include:Available file properties|file-properties
|
||||
@include:Available sheet properties|sheet-properties
|
||||
@include:Available CSS styles|css-styles
|
||||
@include:Available border styles|borders
|
||||
@include:Available column formatting|formatting
|
||||
@include:Closures|closures
|
||||
18
vendor/maatwebsite/excel/docs/reference-guide/borders.md
vendored
Normal file
18
vendor/maatwebsite/excel/docs/reference-guide/borders.md
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
# Available border styles
|
||||
|
||||
| Style name | PHPExcel class reference|
|
||||
| ------------- |-----------------|
|
||||
|none|PHPExcel_Style_Border::BORDER_NONE
|
||||
|dashDot|PHPExcel_Style_Border::BORDER_DASHDOT
|
||||
| dashDotDot|PHPExcel_Style_Border::BORDER_DASHDOTDOT
|
||||
| dashed |PHPExcel_Style_Border::BORDER_DASHED
|
||||
| dotted |PHPExcel_Style_Border::BORDER_DOTTED
|
||||
| double |PHPExcel_Style_Border::BORDER_DOUBLE
|
||||
| hair |PHPExcel_Style_Border::BORDER_HAIR
|
||||
| medium |PHPExcel_Style_Border::BORDER_MEDIUM
|
||||
| mediumDashDot |PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT
|
||||
| mediumDashDotDot |PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT
|
||||
| mediumDashed |PHPExcel_Style_Border::BORDER_MEDIUMDASHED
|
||||
| slantDashDot |PHPExcel_Style_Border::BORDER_SLANTDASHDOT
|
||||
| thick|PHPExcel_Style_Border::BORDER_THICK
|
||||
| thin|PHPExcel_Style_Border::BORDER_THIN
|
||||
10
vendor/maatwebsite/excel/docs/reference-guide/closures.md
vendored
Normal file
10
vendor/maatwebsite/excel/docs/reference-guide/closures.md
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
# Closures
|
||||
|
||||
| Method | Closure class |
|
||||
| ------------- |-------------|
|
||||
| create() | Maatwebsite\Excel\Writers\LaravelExcelWriter |
|
||||
| load() | Maatwebsite\Excel\Readers\LaravelExcelReader |
|
||||
| batch | Maatwebsite\Excel\Readers\Batch |
|
||||
| sheet() | Maatwebsite\Excel\Classes\LaravelExcelWorksheet |
|
||||
| cells() | Maatwebsite\Excel\Writers\CellWriter |
|
||||
| row() | Maatwebsite\Excel\Writers\CellWriter |
|
||||
19
vendor/maatwebsite/excel/docs/reference-guide/css-styles.md
vendored
Normal file
19
vendor/maatwebsite/excel/docs/reference-guide/css-styles.md
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
# Available CSS styles
|
||||
|
||||
Styles that can be used inside an external CSS file or as inline CSS.
|
||||
|
||||
| Style name | Example Value |
|
||||
| ------------- |-------------|
|
||||
| background(-color) | #000000 |
|
||||
| color | #FFFFFF |
|
||||
| font-weight | bold |
|
||||
| font-style | italic |
|
||||
| font-weight | bold |
|
||||
| font-size | 20px |
|
||||
| font-family | Open Sans |
|
||||
| text-decoration | underline |
|
||||
| text-align | center |
|
||||
| vertical-align | middle |
|
||||
| border(-*) | 1px dashed #CCC |
|
||||
| width | 100(px) |
|
||||
| height | 1100(px) |
|
||||
15
vendor/maatwebsite/excel/docs/reference-guide/file-properties.md
vendored
Normal file
15
vendor/maatwebsite/excel/docs/reference-guide/file-properties.md
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
# Available file properties
|
||||
|
||||
Properties that can be set with `$excel->set{$property}()`
|
||||
|
||||
| Property name |
|
||||
| ------------- |
|
||||
|creator
|
||||
|lastModifiedBy
|
||||
|title
|
||||
|description
|
||||
|subject
|
||||
|keywords
|
||||
|category
|
||||
|manager
|
||||
|company
|
||||
37
vendor/maatwebsite/excel/docs/reference-guide/formatting.md
vendored
Normal file
37
vendor/maatwebsite/excel/docs/reference-guide/formatting.md
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
# Available column formatting
|
||||
|
||||
| Format name | PHPExcel class reference|
|
||||
| ------------- |-----------------|
|
||||
|General|PHPExcel_Style_NumberFormat::FORMAT_GENERAL
|
||||
|@|PHPExcel_Style_NumberFormat::FORMAT_TEXT
|
||||
|0|PHPExcel_Style_NumberFormat::FORMAT_NUMBER
|
||||
|0.00|PHPExcel_Style_NumberFormat::FORMAT_NUMBER_00
|
||||
|#,##0.00|PHPExcel_Style_NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1
|
||||
|#,##0.00_-|PHPExcel_Style_NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED2
|
||||
|0%|PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE
|
||||
|0.00%|PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE_00
|
||||
|yyyy-mm-dd|PHPExcel_Style_NumberFormat::FORMAT_DATE_YYYYMMDD2
|
||||
|yy-mm-dd|PHPExcel_Style_NumberFormat::FORMAT_DATE_YYYYMMDD
|
||||
|dd/mm/yy|PHPExcel_Style_NumberFormat::FORMAT_DATE_DDMMYYYY
|
||||
|d/m/y|PHPExcel_Style_NumberFormat::FORMAT_DATE_DMYSLASH
|
||||
|d-m-y|PHPExcel_Style_NumberFormat::FORMAT_DATE_DMYMINUS
|
||||
|d-m|PHPExcel_Style_NumberFormat::FORMAT_DATE_DMMINUS
|
||||
|m-y|PHPExcel_Style_NumberFormat::FORMAT_DATE_MYMINUS
|
||||
|mm-dd-yy|PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX14
|
||||
|d-mmm-yy|PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX15
|
||||
|d-mmm|PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX16
|
||||
|mmm-yy|PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX17
|
||||
|m/d/yy h:mm|PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX22
|
||||
|d/m/y h:mm|PHPExcel_Style_NumberFormat::FORMAT_DATE_DATETIME
|
||||
|h:mm AM/PM|PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME1
|
||||
|h:mm:ss AM/PM|PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME2
|
||||
|h:mm|PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME3
|
||||
|h:mm:ss|PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME4
|
||||
|mm:ss|PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME5
|
||||
|h:mm:ss|PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME6
|
||||
|i:s.S|PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME7
|
||||
|h:mm:ss;@|PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME8
|
||||
|yy/mm/dd;@|PHPExcel_Style_NumberFormat::FORMAT_DATE_YYYYMMDDSLASH
|
||||
|"$"#,##0.00_-|PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE
|
||||
|$#,##0_-|PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD
|
||||
|[$EUR ]#,##0.00_-|PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE
|
||||
18
vendor/maatwebsite/excel/docs/reference-guide/sheet-properties.md
vendored
Normal file
18
vendor/maatwebsite/excel/docs/reference-guide/sheet-properties.md
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
# Available sheet properties
|
||||
|
||||
Properties that can be set with `$sheet->set{$property}()`
|
||||
|
||||
| Property name | Possible value|
|
||||
| ------------- |-----------------|
|
||||
|orientation| string
|
||||
|paperSize| integer
|
||||
|scale| integer
|
||||
|fitToPage| boolean
|
||||
|fitToHeight| boolean
|
||||
|fitToWidth| boolean
|
||||
|columnsToRepeatAtLeft| array
|
||||
|rowsToRepeatAtTop| array
|
||||
|horizontalCentered| boolean
|
||||
|verticalCentered| boolean
|
||||
|printArea| range
|
||||
|firstPageNumber| integer
|
||||
Reference in New Issue
Block a user