update 1.0.8.0
Commits for version update
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();
|
||||
133
vendor/maatwebsite/excel/docs/blade/styling.md
vendored
Normal file
133
vendor/maatwebsite/excel/docs/blade/styling.md
vendored
Normal file
@@ -0,0 +1,133 @@
|
||||
# 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
|
||||
|
||||
Styling can be done through an external CSS file.
|
||||
|
||||
External css file:
|
||||
|
||||
#cell {
|
||||
background-color: #000000;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.cell {
|
||||
background-color: #000000;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
tr td {
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
tr > td {
|
||||
border-bottom: 1px solid #000000;
|
||||
}
|
||||
|
||||
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.
|
||||
|
||||
> It's advised to include `<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />` into the view to fix problems with UTF-8 encoding.
|
||||
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'
|
||||
2
vendor/maatwebsite/excel/docs/changelog.md
vendored
Normal file
2
vendor/maatwebsite/excel/docs/changelog.md
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
@include:Version 1|version-1
|
||||
@include:Version 2|version-2
|
||||
209
vendor/maatwebsite/excel/docs/changelog/version-1.md
vendored
Normal file
209
vendor/maatwebsite/excel/docs/changelog/version-1.md
vendored
Normal file
@@ -0,0 +1,209 @@
|
||||
# Version 1
|
||||
|
||||
### 1.3.5
|
||||
- PHPExcel 1.8.1 compatibility
|
||||
- Clean-up ServiceProvider
|
||||
- Fix short array syntax for PHP5.3
|
||||
|
||||
### 1.3.4
|
||||
- Fix usage of sheet callback when modifying an existing file
|
||||
- Modifying existing files improvements (support style overriding)
|
||||
- Add text-indent support to HtmlReader
|
||||
- Add simple sheet password protection
|
||||
- Add support for exporting multiple pdf pages
|
||||
- Add inline cell formatting to blade
|
||||
|
||||
### 1.3.3
|
||||
- Fix issue with different start row in chunk filter
|
||||
|
||||
### 1.3.2
|
||||
- Custom value binders
|
||||
- Html reader update
|
||||
|
||||
### 1.3.1
|
||||
- Fix short array syntax
|
||||
|
||||
### 1.3.0
|
||||
- Additional headers with export()
|
||||
- Float, integer, string, timestamps problems
|
||||
- Cell content ending by zeros
|
||||
- Images in html
|
||||
- Font family bug
|
||||
- Setting row number of row with headings
|
||||
|
||||
### 1.2.3
|
||||
- PDF writer
|
||||
- Include charts config
|
||||
- Chunk filter with selected sheet
|
||||
- Compatibility fix with new PHPExcel release
|
||||
- setDateColumns fix
|
||||
- Optional dependencies to require-dev
|
||||
- Several bugfixes
|
||||
|
||||
### 1.2.2
|
||||
- Chunk filter fixes
|
||||
- Isset() CellCollection fixes
|
||||
- PHP 5.3 support
|
||||
- Missing border styles
|
||||
- Add CSV settings (delimiter, enclosure, lineEnding) to ExcelFile objects
|
||||
|
||||
### 1.2.1
|
||||
- Fix with() method parameters
|
||||
|
||||
### 1.2.0
|
||||
- Filters
|
||||
- Chunk filter (with chunked importer)
|
||||
- ExcelFile (method) injections
|
||||
- NewExcelFile (method) injections
|
||||
- Edit existing worksheets
|
||||
- Converting existing worksheet
|
||||
- Laravel 4.* + 5.0 support
|
||||
|
||||
### 1.1.9
|
||||
- PHP 5.3 fixes
|
||||
|
||||
### 1.1.8
|
||||
- PHP 5.3 support
|
||||
- fromArray bugfix
|
||||
|
||||
### 1.1.7
|
||||
- Fix heading generation for export with `->fromArray()`
|
||||
- Bugfix for non-Unix kernels
|
||||
- Enhanced CSS parser (thanks to `tijsverkoyen/CssToInlineStyles`)
|
||||
- Support for nested CSS styles
|
||||
- Support for multiple css attributes per class
|
||||
- Support for internal and external CSS files
|
||||
- Support for inline style blocks (`<style>`)
|
||||
|
||||
### 1.1.6
|
||||
|
||||
- Provides.json fix
|
||||
- DocBlock fixes
|
||||
- Define Illuminate dependencies inside composer.json
|
||||
- Better HTML rowspan handling views
|
||||
- use new CellCollection() instead of ::make, to support upcoming Laravel version
|
||||
- Workaround for long integers
|
||||
- Add support to `wrap-text` in views
|
||||
- Fix empty dates parsing
|
||||
- Support local stylesheets in view parsing
|
||||
- Push tr classes to td-children in views
|
||||
- Support for dynamically appending rows to an empty (new) sheet
|
||||
- Fix separator typo in config
|
||||
|
||||
### 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
|
||||
23
vendor/maatwebsite/excel/docs/changelog/version-2.md
vendored
Normal file
23
vendor/maatwebsite/excel/docs/changelog/version-2.md
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
# Version 2
|
||||
|
||||
### 2.0.4
|
||||
- PHPExcel 1.8.1 compatibility
|
||||
- Clean-up ServiceProvider
|
||||
|
||||
### 2.0.3
|
||||
- Fix usage of sheet callback when modifying an existing file
|
||||
- Modifying existing files improvements (support style overriding)
|
||||
- Add text-indent support to HtmlReader
|
||||
- Add simple sheet password protection
|
||||
- Add support for exporting multiple pdf pages
|
||||
- Add inline cell formatting to blade
|
||||
|
||||
### 2.0.2
|
||||
- Fix issue with different start row in chunk filter
|
||||
|
||||
### 2.0.1
|
||||
- Custom value binders
|
||||
- Html reader update
|
||||
|
||||
### 2.0.0
|
||||
- Laravel 5 release
|
||||
16
vendor/maatwebsite/excel/docs/export.md
vendored
Normal file
16
vendor/maatwebsite/excel/docs/export.md
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
@include:Creating a new file|simple
|
||||
@include:Exporting|export
|
||||
@include:NewExcelFile injections|injection
|
||||
@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.
|
||||
63
vendor/maatwebsite/excel/docs/export/cells.md
vendored
Normal file
63
vendor/maatwebsite/excel/docs/export/cells.md
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
# 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(
|
||||
'top' => array(
|
||||
'style' => 'solid'
|
||||
),
|
||||
));
|
||||
|
||||
### Set horizontal alignment
|
||||
|
||||
// Set alignment to center
|
||||
$cells->setAlignment('center');
|
||||
|
||||
### Set vertical alignment
|
||||
|
||||
// Set vertical alignment to middle
|
||||
$cells->setValignment('center');
|
||||
34
vendor/maatwebsite/excel/docs/export/export.md
vendored
Normal file
34
vendor/maatwebsite/excel/docs/export/export.md
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
# 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
|
||||
|
||||
#### Export to PDF
|
||||
|
||||
To export files to pdf, you will have to include `"dompdf/dompdf": "~0.6.1"`, `"mpdf/mpdf": "~5.7.3"` or `"tecnick.com/tcpdf": "~6.0.0"` in your `composer.json` and change the `export.pdf.driver` config setting accordingly.
|
||||
|
||||
->export('pdf');
|
||||
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');
|
||||
61
vendor/maatwebsite/excel/docs/export/injection.md
vendored
Normal file
61
vendor/maatwebsite/excel/docs/export/injection.md
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
# NewExcelFile injections
|
||||
|
||||
Following the Laravel 5.0 philosophy with its new awesome FormRequest injections, we introduce you NewExcelFile injections.
|
||||
|
||||
## NewExcelFile class
|
||||
|
||||
This NewExcelFile is a wrapper for a new Excel file. Inside the `getFilename()` you can declare the wanted filename.
|
||||
|
||||
class UserListExport extends \Maatwebsite\Excel\Files\NewExcelFile {
|
||||
|
||||
public function getFilename()
|
||||
{
|
||||
return 'filename';
|
||||
}
|
||||
}
|
||||
|
||||
## Usage
|
||||
|
||||
You can inject these NewExcelFiles inside the __constructor or inside the method (when using Laravel 5.0), in e.g. the controller.
|
||||
|
||||
class ExampleController extends Controller {
|
||||
|
||||
public function exportUserList(UserListExport $export)
|
||||
{
|
||||
// work on the export
|
||||
return $export->sheet('sheetName', function($sheet)
|
||||
{
|
||||
|
||||
})->export('xls');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
## Export Handlers
|
||||
|
||||
To decouple your Excel-export code completely from the controller, you can use the export handlers.
|
||||
|
||||
class ExampleController extends Controller {
|
||||
|
||||
public function exportUserList(UserListExport $export)
|
||||
{
|
||||
// Handle the export
|
||||
$export->handleExport();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
The `handleExport()` method will dynamically call a handler class which is your class name appended with `Handler`
|
||||
|
||||
class UserListExportHandler implements \Maatwebsite\Excel\Files\ExportHandler {
|
||||
|
||||
public function handle(UserListExport $export)
|
||||
{
|
||||
// work on the export
|
||||
return $export->sheet('sheetName', function($sheet)
|
||||
{
|
||||
|
||||
})->export('xls');
|
||||
}
|
||||
|
||||
}
|
||||
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
|
||||
77
vendor/maatwebsite/excel/docs/export/sheets.md
vendored
Normal file
77
vendor/maatwebsite/excel/docs/export/sheets.md
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
# 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 inside 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);
|
||||
|
||||
### Password protecting a sheet
|
||||
|
||||
A sheet can be password protected with `$sheet->protect()`:
|
||||
|
||||
// Default protect
|
||||
$sheet->protect('password');
|
||||
|
||||
// Advanced protect
|
||||
$sheet->protect('password', function(\PHPExcel_Worksheet_Protection $protection) {
|
||||
$protection->setSort(true);
|
||||
});
|
||||
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
|
||||
18
vendor/maatwebsite/excel/docs/getting-started/config.md
vendored
Normal file
18
vendor/maatwebsite/excel/docs/getting-started/config.md
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
#Config
|
||||
|
||||
### Laravel 4
|
||||
|
||||
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`
|
||||
|
||||
### Laravel 5
|
||||
|
||||
To publish the config settings in Laravel 5 use:
|
||||
|
||||
php artisan vendor:publish
|
||||
|
||||
This will add an `excel.php` config file to your config folder.
|
||||
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.
|
||||
23
vendor/maatwebsite/excel/docs/getting-started/installation.md
vendored
Normal file
23
vendor/maatwebsite/excel/docs/getting-started/installation.md
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
#Installation
|
||||
|
||||
Require this package in your `composer.json` and update composer. This will download the package and PHPExcel of PHPOffice.
|
||||
|
||||
#### Laravel 4
|
||||
|
||||
"maatwebsite/excel": "~1.3"
|
||||
|
||||
#### Laravel 5
|
||||
|
||||
"maatwebsite/excel": "~2.1.0"
|
||||
|
||||
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)
|
||||
14
vendor/maatwebsite/excel/docs/import.md
vendored
Normal file
14
vendor/maatwebsite/excel/docs/import.md
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
@include:Importing a file|basics
|
||||
@include:ExcelFile injections|injection
|
||||
@include:Handling results|results
|
||||
@include:Selecting sheets and columns|select
|
||||
@include:Dates|dates
|
||||
@include:Calculation|calculation
|
||||
@include:Custom formatting values|formatting
|
||||
@include:Caching and cell caching|cache
|
||||
@include:Chunk importing|chunk
|
||||
@include:Batch import|batch
|
||||
@include:Import by config|config
|
||||
@include:Edit existing files|edit
|
||||
@include:Converting|convert
|
||||
@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);
|
||||
49
vendor/maatwebsite/excel/docs/import/chunk.md
vendored
Normal file
49
vendor/maatwebsite/excel/docs/import/chunk.md
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
# Chunk importer
|
||||
|
||||
When dealing with big files, it's better to import the data in big chunks. You can enable this with `filter('chunk')`;
|
||||
To import it into chunks you can use `chunk($size, $callback)` instead of the normal `get()`. The first parameter is the size of the chunk. The second parameter is a closure which will return the results.
|
||||
|
||||
Excel::filter('chunk')->load('file.csv')->chunk(250, function($results)
|
||||
{
|
||||
foreach($results as $row)
|
||||
{
|
||||
// do stuff
|
||||
}
|
||||
});
|
||||
|
||||
## ExcelFile class example:
|
||||
|
||||
When working with ExcelFile injections (in the constructor or as method injection), you can enable the chunk filter inside the ExcelFile class
|
||||
|
||||
class UserListImport extends \Maatwebsite\Excel\Files\ExcelFile {
|
||||
|
||||
public function getFile()
|
||||
{
|
||||
return 'file.csv';
|
||||
}
|
||||
|
||||
public function getFilters()
|
||||
{
|
||||
return [
|
||||
'chunk'
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Injected ExcelFile example:
|
||||
|
||||
public function importUserList(UserListImport $import)
|
||||
{
|
||||
$import->chunk(250, function($results)
|
||||
{
|
||||
// do stuff
|
||||
// or return true if you want to stop importing.
|
||||
});
|
||||
}
|
||||
|
||||
## Queued chunks
|
||||
|
||||
We automatically queue every chunk for you, if you have enabled the queue driver in your config.
|
||||
|
||||
If you want to by-pass the behaviour, you can pass `false` as third param of `chunk($size, $callback, $shouldQueue)`.
|
||||
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()`.
|
||||
9
vendor/maatwebsite/excel/docs/import/convert.md
vendored
Normal file
9
vendor/maatwebsite/excel/docs/import/convert.md
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
# Converting
|
||||
|
||||
You can convert from one filetype to another by using `->convert()`
|
||||
|
||||
Excel::load('file.csv', function($file) {
|
||||
|
||||
// modify stuff
|
||||
|
||||
})->convert('xls');
|
||||
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();
|
||||
9
vendor/maatwebsite/excel/docs/import/edit.md
vendored
Normal file
9
vendor/maatwebsite/excel/docs/import/edit.md
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
# Editing existing files
|
||||
|
||||
You can edit existing Excel files, by loading them and after modification exporting them.
|
||||
|
||||
Excel::load('file.csv', function($file) {
|
||||
|
||||
// modify stuff
|
||||
|
||||
})->export('csv');
|
||||
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`.
|
||||
38
vendor/maatwebsite/excel/docs/import/formatting.md
vendored
Normal file
38
vendor/maatwebsite/excel/docs/import/formatting.md
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
# Custom formatting values
|
||||
|
||||
By default Laravel Excel uses PHPExcel's default value binder to intelligently format a cells value when reading it. You may override this behavior by passing in your own value binder to suit your specific needs. Value binders must implement PHPExcel_Cell_IValueBinder and have a bindValue method. They may also extend PHPExcel_Cell_DefaultValueBinder to return the default behavior.
|
||||
|
||||
use PHPExcel_Cell;
|
||||
use PHPExcel_Cell_DataType;
|
||||
use PHPExcel_Cell_IValueBinder;
|
||||
use PHPExcel_Cell_DefaultValueBinder;
|
||||
|
||||
class MyValueBinder extends PHPExcel_Cell_DefaultValueBinder implements PHPExcel_Cell_IValueBinder
|
||||
{
|
||||
public function bindValue(PHPExcel_Cell $cell, $value = null)
|
||||
{
|
||||
if (is_numeric($value))
|
||||
{
|
||||
$cell->setValueExplicit($value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// else return default behavior
|
||||
return parent::bindValue($cell, $value);
|
||||
}
|
||||
}
|
||||
|
||||
$myValueBinder = new MyValueBinder;
|
||||
|
||||
Excel::setValueBinder($myValueBinder)->load('file.xls', function($reader) {
|
||||
|
||||
// reader methods
|
||||
|
||||
});
|
||||
|
||||
Available PHPExcel_Cell_DataType's are TYPE_STRING, TYPE_FORMULA, TYPE_NUMERIC, TYPE_BOOL, TYPE_NULL, TYPE_INLINE and TYPE_ERROR
|
||||
|
||||
To reset the value binder back to default and/or before calling Laravel Excel after setting a custom value binder you need to call the resetValueBinder method.
|
||||
|
||||
Excel::resetValueBinder();
|
||||
87
vendor/maatwebsite/excel/docs/import/injection.md
vendored
Normal file
87
vendor/maatwebsite/excel/docs/import/injection.md
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
# ExcelFile injections
|
||||
|
||||
Following the Laravel 5.0 philosophy with its new awesome FormRequest injections, we introduce you ExcelFile injections.
|
||||
|
||||
## ExcelFile class
|
||||
|
||||
This class is a wrapper for a file on your server. Inside the `getFile()` method you return the filename and it's location. Inside the `getFilters()` method you can enable filters, like the chunk filter.
|
||||
|
||||
class UserListImport extends \Maatwebsite\Excel\Files\ExcelFile {
|
||||
|
||||
public function getFile()
|
||||
{
|
||||
return storage_path('exports') . '/file.csv';
|
||||
}
|
||||
|
||||
public function getFilters()
|
||||
{
|
||||
return [
|
||||
'chunk'
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
If you want to have the `getFile()` dynamic based on user's input, you can easily do:
|
||||
|
||||
public function getFile()
|
||||
{
|
||||
// Import a user provided file
|
||||
$file = Input::file('report');
|
||||
$filename = $this->doSomethingLikeUpload($file);
|
||||
|
||||
// Return it's location
|
||||
return $filename;
|
||||
}
|
||||
|
||||
## Usage
|
||||
|
||||
You can inject these ExcelFiles inside the __constructor or inside the method (when using Laravel 5.0), in e.g. the controller.
|
||||
|
||||
class ExampleController extends Controller {
|
||||
|
||||
public function importUserList(UserListImport $import)
|
||||
{
|
||||
// get the results
|
||||
$results = $import->get();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
## CSV Settings
|
||||
|
||||
You can pass through optional CSV settings, like `$delimiter`, `$enclosure` and `$lineEnding` as protected properties of the class.
|
||||
|
||||
class UserListImport extends \Maatwebsite\Excel\Files\ExcelFile {
|
||||
|
||||
protected $delimiter = ',';
|
||||
protected $enclosure = '"';
|
||||
protected $lineEnding = '\r\n';
|
||||
|
||||
}
|
||||
|
||||
## Import Handlers
|
||||
|
||||
To decouple your Excel-import code completely from the controller, you can use the import handlers.
|
||||
|
||||
class ExampleController extends Controller {
|
||||
|
||||
public function importUserList(UserListImport $import)
|
||||
{
|
||||
// Handle the import
|
||||
$import->handleImport();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
The `handleImport()` method will dynamically call a handler class which is your class name appended with `Handler`
|
||||
|
||||
class UserListImportHandler implements \Maatwebsite\Excel\Files\ImportHandler {
|
||||
|
||||
public function handle(UserListImport $import)
|
||||
{
|
||||
// get the results
|
||||
$results = $import->get();
|
||||
}
|
||||
|
||||
}
|
||||
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