Giter Site home page Giter Site logo

spartnernl / laravel-excel Goto Github PK

View Code? Open in Web Editor NEW
12.0K 12.0K 1.9K 3.18 MB

🚀 Supercharged Excel exports and imports in Laravel

Home Page: https://laravel-excel.com

License: MIT License

PHP 99.95% Blade 0.05%
csv laravel laravel-5-package laravel-package php phpexcel phpoffice

laravel-excel's Introduction



Laravel Excel logo


Supercharged Excel exports and imports

A simple, but elegant Laravel wrapper around PhpSpreadsheet exports and imports.

Github Actions StyleCI Latest Stable Version Total Downloads License

✨ Features

  • Easily export collections to Excel. Supercharge your Laravel collections and export them directly to an Excel or CSV document. Exporting has never been so easy.

  • Supercharged exports. Export queries with automatic chunking for better performance. You provide us the query, we handle the performance. Exporting even larger datasets? No worries, Laravel Excel has your back. You can queue your exports so all of this happens in the background.

  • Supercharged imports. Import workbooks and worksheets to Eloquent models with chunk reading and batch inserts! Have large files? You can queue every chunk of a file! Your entire import will happen in the background.

  • Export Blade views. Want to have a custom layout in your spreadsheet? Use a HTML table in a Blade view and export that to Excel.

banner

🎓 Learning Laravel Excel

You can find the full documentation of Laravel Excel on the website.

We welcome suggestions for improving our docs. The documentation repository can be found at https://github.com/SpartnerNL/laravel-excel-docs.

Some articles and tutorials can be found on our blog: https://medium.com/maatwebsite/laravel-excel/home

📬 License & Postcardware

1_5nblgs68uarg0wxxejozdq

Laravel Excel is created with love and care by Spartner (formerly known as Maatwebsite) to give back to the Laravel community. It is completely free (MIT license) to use, however the package is licensed as Postcardware. This means that if it makes it to your production environment, we would very much appreciate receiving a postcard from your hometown.

Spartner Markt 2 6231 LS Meerssen The Netherlands.

More about the license can be found at: https://docs.laravel-excel.com/3.1/getting-started/license.html

Created by Spartner (formerly Maatwebsite)

We are a strategic development partner, creating web-based custom built software from Laravel. In need of a digital solution for your challenge? Give us a call.

https://spartner.software [email protected] +31 (0) 10 - 7449312

🔧 Supported Versions

Versions will be supported for a limited amount of time.

Version Laravel Version Php Version Support
2.1 <=5.6 <=7.0 Unsupported since 15-5-2018
3.0 ^5.5 ^7.0 Unsupported since 31-12-2018
3.1 >=5.8 | <=11.x ^7.2 | ^8.0 New features

laravel-excel's People

Contributors

ahmedash95 avatar brandondrew avatar devinfd avatar devoncmather avatar devonmather avatar drakakisgeo avatar driesvints avatar frankpeters avatar fsilvestro avatar gerardnll avatar glennm avatar grahamcampbell avatar hicode avatar iftaras avatar jeroenvossen avatar kenowessels avatar lk77 avatar maatwebsitesupport avatar mewben avatar mikesir87 avatar opb avatar patrickbrouwers avatar siarheipashkevich avatar srobati avatar stylecibot avatar svenbw avatar tooblue avatar trouttdev avatar vfandrew avatar vroomfondle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

laravel-excel's Issues

id column disapears

i'm tyring to import a csv file containing id,title pair rows
doing

Excel::load($file, true) // second parameter will make sure the first row is interpreted as heading
    ->select(array('id', 'title'))
    ->toArray();

return just array of titles, someone (this package of PHPExcel) eats id column!

During import... Undefined variable: fileHandle

I tried a simple piece of code:

Route::get('excel-import', function() {
    $path = public_path() . '\members.csv';
    Excel::load($path)->dump();
});

And Laravel 4.1 tells me this:

ErrorException: Undefined variable: fileHandle

It pin point me to \vendor\phpoffice\phpexcel\Classes\PHPExcel\Reader\CSV.php which I fixed the error by changing line 147:

rewind($fileHandle);

to

rewind($this->_fileHandle);

Tada! problem fixed.

Export from view file

Hi

I'm using your wrapper, i'm having problems exporting to xls from view file. I pass a data variable
as a parameter and then i make an echo y the view file, but it does nothing, if i don't use any php statement it does the export, i don't find other way to pass the data and render in the view.

If you have some example it would great.

Cells after cell with colspan are empty

There's a bug in the column spanning. Here's a test case to reproduce it. Note the second <td> element has its colspan attribute set to 1 for comparison. The two cells to the right of the 18-wide cell are blank, but those to the right of the 1-wide cell are as expected.

<tbody class="GROCERY_NON-FOOD">
  <tr>
    <td colspan="18" style="text-align: right;"><strong>Grocery_Non-Food Total Gross Margin: </strong></td><td>7.13%</td><td>10.82%</td>
  </tr>
</tbody>
<tbody class="GROCERY_NON-FOOD">
  <tr>
    <td colspan="1" style="text-align: right;"><strong>All Departments Total Gross Margin: </strong></td><td>7.13%</td><td>10.82%</td>
  </tr>
</tbody>

How to save correctly?

Heres what I am trying to do and probably doing it all wrong! But is there a way to update the object then re-write/save it?

I have read the file in as an object type. Converted it to json did some string replacements on it then converted it back to an object. Now I want to take that object and save it back out with the new variables in it.

Other Info:
Basically I have a template xlsx file with things like {{goal0}} so I want to be able to replace those with actual values and save it so I can send out a mass email with it updated.

Cannot get Excel::sheet() to work

I have the following sample code:

$spreadsheet = Excel::sheet(
                        'SomeName',
                        function($sheet) use($data) {
                          $sheet->loadView('folder.blade-file');
                          $sheet->with($data);
                      });

I've tested the blade file separately with View::make() and it works just fine. But when used on the above scenario, I get the following error:

PHPExcel_Exception
Settings data for sheets inside closures can only be used when a view has been loaded. Use ->loadView('filename')

Ultimately I want to use different templates for different sheets which is why I'm trying the above syntax as opposed to Excel::loadView(). I may have misunderstood the documentation somehow and this is probably a "user error" on my part, but I'd sure appreciate a pointer in the right direction.

Thanks!

Excel format not correct / possibility to save in other?

When i export the xls, i need to upload this to another website which processes these excel files (which is out of my hands) but it fails on the format. If i open it in excel and save the file in excel 95 or 2007 format and then upload it, it works.

Is there a way to save it differently? So say excel 5? Maybe that helps in my situation. Or is this is a PHPExcel issue itself? (after saving btw, the original file is 7kb, the saved one in excel is then 23kb)

Call to undefined method setDelimiter()

using a simple single sheet, two column (id, title) xls file, doing:

$data = Excel::load($file, true) // second parameter will make sure the first row is interpreted as heading
    ->select(array('title','id'));

give back:
Call to undefined method PHPExcel_Reader_Excel5::setDelimiter()

working with xlsx format is not much different:
Call to undefined method PHPExcel_Reader_Excel2007::setDelimiter()

loaded data reset needed

Hello, when I load to array multiple csv files in foreach(or one after another), the array is not resetting. And i get an array with all values of previous files.
And it always get first file columns. Even if i set what column indexes to get it ignores it.
It would be great to have some before load reset array function. Something like:

 public function reset()
 {
      $this->isParsed = false;
 }

With this it loads good. If there is some other solution to do that it would be great if you could suggest it. Here is my sample code:

foreach($files as $file){
    Excel::reset(); // added manualy
    $result = Excel::load(public_path().'/assets/csv/'.$file->file)->toArray();
    foreach($result as $key => $value){
                // duplicates values if reset is not used above function
        }
}

Strange behaviour since upgrading to 0.3.x

Hello!

I'm having some trouble since I updated to 0.3.4.

  • The setColumnFormat() doesn't work/trigger - it did on 0.2.x
  • The setAutoFilter() doesn't work/trigger - it did on 0.2.x
  • sheet() doesn't set the sheetname, it's still "Worksheet" - I've never gotten it to work.

When I try to export data as xlsx I get a popup that Excel found unreadable content in the file.
It works when exporting as xls.

composer.json

"phpoffice/phpexcel": "1.8.*@dev", (1.8.0)
"maatwebsite/excel": "dev-master" (dev-master 10d5f8d)

Export code

$name = "Sheet Name 2014-04-14";
Excel::create($name)
        ->sheet($name)
            ->loadView('view')
                ->with('variable', $variable)
            ->setColumnFormat(array(
                "C2:C{$count}" => '0000'
             ))
            ->setAutoFilter()
        ->export('xlsx');

Thank you for a great package and if you need any more info just shout. :)

First row is empty when using 'loadView'

When loading the below table using loadView the first row in the Excel sheet is empty and the data starts on row two.

Using:

Excel::loadView('table')
         ->setTitle('Title')
         ->sheet('Title')
         ->export('xls');

table.blade.php:

<table>
    <thead>
        <tr>
            <th>Column 01</th>
            <th>Column 02</th>
            <th>Column 03</th>
            <th>Column 04</th>
            <th>Column 05</th>
            <th>Column 06</th>
            <th>Column 07</th>
            <th>Column 08</th>
            <th>Column 09</th>
            <th>Column 10</th>
            <th>Column 11</th>
        </tr>
    </thead>
    <tbody>
            <tr>
            <td>Value 1</td>
            <td>Value 2</td>
            <td>0030</td>
            <td>Test value 4</td>
            <td>Value 5</td>
            <td>Value 6</td>
            <td>Value 7</td>
            <td>Value 8</td>
            <td>Value 9</td>
            <td>Value 10</td>
            <td>Value 00011</td>
        </tr>
        </tbody>
</table>

exporting using ajax doesn't download the file

If I call this route using ajax, I don't get a prompt to download the file. I can see the content by using firebug.

Route::get('courses',function(){
    $result = Courses::all();
                Excel::create('TestCSVCase')
                    ->sheet('SheetName')
                    ->with($result->toArray())->export('csv');
});

Dates

My dates are showing up (41593) when it should read 11/23/2013, any help would be much appreciated!

Thanks

Support for ->with syntax

It would be preferable if the standard Laravel -> with syntax were supported with the Excel::loadView() method, as it is cleaner & more readable, and consistent with the way things are done elsewhere in Laravel. For example:

$spreadsheet = Excel::loadView('promos')
                    -> with ('report', $report)
                    -> with ('commodities', $commodities)
                    -> with ('ad_event_offers', $ad_event_offers)
                    -> with ('report_slug', $this->report_slug)
                    -> with ('column_count', 20)
                    -> with ('column_indent', 1)
                    ->setTitle($file_name)
                    ->sheet($this->report_title)
                    ->store($ext, public_path().'/ad-reports')
                    ->export($ext);

functions from PHPExcel not working in laravel4-PHPExcel

I don't know if there is a problem with this package, or if I'm just misunderstanding the way that native PHPExcel methods are (or are not) available when using laravel4-PHPExcel, but the following code does not work as expected:

// this works fine:
$spreadsheet = Excel::create($file_name)
            ->sheet($report_title)
            ->with($report)
            ->setFreeze('A2');

// This does nothing, but if I change the index to 1 it complains, 
// so it's not being ignored completely
$spreadsheet->setActiveSheetIndex(0)
            ->SetCellValue('A1', 'Hello')
            ->SetCellValue('B2', 'world!')
            ->SetCellValue('C1', 'Hello')
            ->SetCellValue('D2', 'world!');

// This fails completely
$spreadsheet->getActiveSheet()->setTitle('Testing');

// This fails completely
$spreadsheet->getProperties()
            ->setCreator('Ad-Related Reports')
            ->setLastModifiedBy('InSite')
            ->setTitle($report_title)
            ->setSubject($report_title);

// as does this...
$spreadsheet->getProperties()
            ->setDescription($report_title ." for Ad Week ". $report[0]['ad_week'])
            ->setKeywords("DC Promo Offers Report")
            ->setCategory("DC Promo Offers Report");

// this is the only thing  after the bit at the top that works!
$spreadsheet->setAutoFilter()
            ->store($ext, public_path().'/ad-reports')
            ->export($ext);

failed to open stream: invalid argument

I get this error when trying to save csv file to a folder. The folder itself has write permission set correctly.

{"error":{"type":"ErrorException","message":"fopen(/C:\inetpub\wwwroot\learning\laravel-administrator-crud/exports/TestCSVCase.csv): failed to open stream: Invalid argument","file":"C:\inetpub\wwwroot\learning\laravel-administrator-crud\vendor\phpoffice\phpexcel\Classes\PHPExcel\Writer\CSV.php","line":111}}

Urgent - During import showing dates instead of data in xls file

I'm trying to import dummy data from xls file. But instead of showing data i'm getting todays date. my xls file data are:
a b c d
adnan shawkat something done
asdfasd asdfsadf asdfasdf asdfsda

 if (Input::hasFile('file')){
        $file = Input::file('file');
        $ext = Input::file('file')->getClientOriginalExtension();
        echo $ext;
        if ($ext == "csv" || $ext == "xlsx" || $ext == 'xls'){
            echo "<pre>"; print_r(Excel::load($file, true)->select(array('a', 'd'))->dump());
            return "OK";
            }
        else return "not our type";
    } else return "not ok";

In the above code section i'm only getting the dates as output please see the output below:

xls

Array
(
[0] => Array
(
[a] => 2014-03-06
[d] => 2014-03-06
)

[1] => Array
    (
        [a] => 2014-03-06
        [d] => 2014-03-06
    )

)

OK

Can anyone please tell me what is wrong in there? It's getting the first row as heading but no data only dates why? Urgent please give me a solution.

Cannot read Ñ on load.

I have a csv file that contains the character Ñ. When I import the csv,

$data = Excel::load('file.csv')->toArray();
print_r($data);

The cell that contains Ñ is read as 0. Is this a bug?

Please help.. Thank you.

File name is longer than the maximum allowed path length on this platform (4096)

My code is as follows:
public function getExcel(){
$inschrijvingen = Inschrijving::orderBy('created_at', 'DESC')->get();
Excel::loadView('admin.excel', array('inschrijvingen' => $inschrijvingen))
->setTitle('inschrijvingen_play_and_sport')
->sheet('Inschrijvingen')
->export('xls');
return Redirect::to('admin/inschrijving');
}

Then I get an exception is_file() with the above exception and all the data that is passed to the view.

unable to install on laravel 4.1

I get following error message when trying to install phpexcel bundle.

I added
"require": {
"laravel/framework": "4.1.*",
"maatwebsite/excel": "dev-master"
},

to the composer.json and ran composer update command.

I get the following error message.


C:\laravel-administrator-crud>composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

Problem 1
- Installation request for maatwebsite/excel dev-master -> satisfiable by ma
atwebsite/excel[dev-master].
- maatwebsite/excel dev-master requires phpoffice/phpexcel dev-develop -> no
matching package found.

Potential causes:

Read http://getcomposer.org/doc/articles/troubleshooting.md for further common
problems.

Adding style to sheets

How do you use the view across all the sheets? Currently only the first sheet has the styles in the view applied to it. The code I use is below:

$excel_file = Excel::loadView("export.excel")
->sheet('Daily')->with( $daily_array )->setColumnWidth( $widths )->setColumnFormat( $formats )
->sheet('Hourly')->with( $hourly_array )->setColumnWidth( $widths )->setColumnFormat( $formats )
->setTitle('WebsiteExport');

$excel_file->export('xls');

The Column width and format works fine.

Throwing an Undefined index error

I tried importing a .csv file.
If I import it without passing the second parameter, it's okay. However, I want to get headers, so I tried passing the second parameter as true. It gives me an "undefined index" exception.

By trying to find out what's wrong, it seems to me that the error is caused by the null value of the column next to the last column with value. I tried inserting values to the columns and the "undefined index" exception just keeps on going every time it hits the column next to the last column with value.

I did, however, found a workaround, by putting a comma, which is the delimiter, in the column next to the last column with value. It worked so far.

update readme

#config
php artisan config:publish Maatwebsite/excel
to
php artisan config:publish maatwebsite/excel

no matching dependency package

in composer.json, i require

        "maatwebsite/excel": "dev-master"

and i get

$php composer.phar update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for maatwebsite/excel dev-master -> satisfiable by maatwebsite/excel[dev-master].
    - maatwebsite/excel dev-master requires phpoffice/phpexcel dev-master -> no matching package found.

Potential causes:
 - A typo in the package name
 - The package is not available in a stable-enough version according to your minimum-stability setting
   see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.

Read <http://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.

Stylesheet support?

Is it possible and realistic to support some limited styling defined in stylesheets?

The advantage to this is in situations where the HTML being used for the Excel report is also being used to generate HTML for browsers, so best practices for normal HTML are followed, and inline styles (and <b> tags, even worse!) are avoided.

This allows less code duplication (no need to have two different entire sets of HTML templates, one for HTML and one for Excel) and therefore easier maintenance, and therefore happier developers.

I would assume that the support would be limited to very basic text formatting, since that's mainly what would be wanted in spreadsheets.

Support for spanned cells

It would be very useful if loadHtml (and therefore loadView) supported spanned cells in the parsed HTML. This is very common in the sorts of spreadsheets we have to generate, and since we also have to generate HTML and PDF versions of them, it would be very nice if we could base them all on the HTML.

app share?

I am trying to create two separate excel files in one execution of my script. However, I get the error "exception 'PHPExcel_Exception' with message 'You tried to set a sheet active by the out of bounds index: 1. The actual number of sheets is 1.'"

Is it not possible to do what I am trying to do? Here is my code:
Excel::create($fileName)->sheet('Ark 1')->with($this->getMergedContent($parameters))->store('xls', storage_path().'/exports/');

This is run two times. However, both files are created with the right content.

Maybe this is due to the use of app->share instead of app->bind?

Exporting search options and results - Suggestions?

I have a report that has multiple search options. I need to add the options into the csv file.

I tried adding an HTML table just for the options but it didn't work, in that, it wasn't included in the csv file. I deleted all of the cache files before testing.

I thought about creating a blade file specifically for Excel. Where the search criteria would be inserted as the first row but I'm lazy.

Any suggestions?

Context

  1. The file format has to be csv
  2. My report uses the same blade for viewing the results via the browser and when exporting to a csv file.
  3. The 2nd HTML table that cycles through the results does produce the correct output.
<!-- table.blade.php -->

<!-- List Search Criteria - $inputArray format is csv -->
@if ( isset( $inputArray['format'] ) && $inputArray['format'] == 'csv' )
<table>
    <tbody>
    <tr>
        <td>
            Searched By:
            @foreach ( $inputArray as $key => $val )
                {{ $key }} {{ $val }}
            @endforeach
        </td>
    </tr>
    </tbody>
</table>
@endif

<!-- results table - results work -->
<table id="user-list" class="table table-striped table-bordered table-hover sortable-theme-bootstrap" data-sortable>
    <thead>
      ...
    </thead>
    <tfoot>
        ...
    </tfoot>
    <tbody>
        ...
    </tbody>
</table>

Native PHPExcel functions don't seem to work when creating a spreadsheet with loadView()

I took some code that worked fine when I was using View::make and tried using it with a spreadsheet creating using loadView. The comments show the added bit that's not working but did work fine before.

$spreadsheet = Excel::loadView('promos_xl_html', array(
                      'report' => $report,
                      'first' => $report[0],
                      'commodities' => $departments,
                      'ad_event_offers' => $ad_event_offers,
                      'report_slug' => $this->report_slug,
                      'column_count' => 20,
                      'column_indent' => 1
                    ))
                    ->setTitle($file_name)
// all the code between HERE 
                    ->sheet($this->report_title.'hi')
                    ->setFreeze('A2');

$worksheet = $spreadsheet->getActiveSheet();
$columnID = 'A';
$lastColumn = $worksheet->getHighestColumn();
$lastColumn++;
do {
  $worksheet->getColumnDimension($columnID)->setAutoSize(true);
  $columnID++;
} while ($columnID != $lastColumn);
// and HERE works when using the $spreadsheet = View::make approach
// but does not work in this context with Excel::loadView

$spreadsheet
            // ->store($ext, public_path().'/ad-reports')
            ->export($ext);

only saving new created sheet, not downloading

Hi,
first of all this is a great and very usefully package. thanks to the developer.

i have just one issue, i need to create a sheet from a php array and than to save the generated file to a server location. i have tryed following:

Excel::create('ExcelName')
->sheet('SheetName')
->with(array('data', 'data'))
->save('xls','www/uploads/xls/');

the only thing what happens is that the download and saving dialog from the browser pops up. But i just want to save the file to a predefined location not downloading the file. i have to create this file in process of a php action for a web application and do not need the download funtionality.

is there any was to prevent the download window. the user should not recognize the create action

thanks Ludwig

A way to force cell contents to be interpreted as text

Excel has a sometimes helpful but unfortunately often unhelpful habit of assuming it knows what kind of data you have in a cell, and formatting accordingly. I have HTML like this

<td colspan="19" class="text coupon">108214</td>

and of course I'm getting everything in a very wide cell all positioned on the right. When Excel opens that particular cell is hidden from view, making matters worse.

Since PHPExcel can explicitly format anything as text, it would be extremely useful to have a way make this easy when building Excel files from Laravel views. Perhaps we could specify an array of classes that should be interpreted as text? Something like this:

$spreadsheet = Excel::loadView('promos_xl_html', array(
                      'report' => $report
                    ))
                    ->dataTypes(array('text' => array('text'), 'number' => array('number','total', 'subtotal'), 'currency' => array('price', 'cost', 'margin')
                    ->setTitle($file_name)
                    ->sheet($this->report_title)
                    ->export($ext);

pls solve

undefined property: Maatwebsite\Excel\Excel::$firstRowAsLabel

Currency and Percentages are appearing in Excel as Text

I have several columns of data with numeric values that begin with $ or end with %, and are all being treated as the Excel type 'Text'. Since Excel's normal behavior (AFAIK) is to assume these should be Currency with $ or a Percentage with a %, I am inferring that laravel4-PHPExcel is interpreting these as text (probably since they do not match a regex of /[\d\,\.]+/) and telling PHPExcel to create the spreadsheet with those cells specifically formatted as Text.

Field return boolean false when the text is too big?

Hello, I ran into this strange problem while trying to import a csv file. I had a field which contains "description" of the product, but for some reason, if the text in this field is too long, it will return "boolean false". How do I fix this?

Add xlsx/Excel2007 extension to 'decodeFormat'

I added the ability to export xlsx files by adding below to the decodeFormat function.

case 'xlsx':
    return 'Excel2007';
    break;

I only tried the export function, so I guess you want to do some more testing with it. :)

Call to undefined method Illuminate\\Foundation\\Application::bindShared() when running any Artisan command

When I run any "artisan" command (eg. php artisan dump-autoload) after having added the configuration to app/config/app.php it breaks like this:

{"error":{"type":"Symfony\\Component\\Debug\\Exception\\FatalErrorException","message":"Call to undefined method Illuminate\\Foundation\\Application::bindShared()","file":"\/Users\/jcivancevich\/Documents\/Work\/Resermap\/dev\/mresermap\/vendor\/maatwebsite\/excel\/src\/Maatwebsite\/Excel\/ExcelServiceProvider.php","line":45}}

It breaks even when trying to publish the package config.

I'm using Laravel 4.0.10

Thanks!

Recursion object when using ->store method

Hi there,

First up, thanks so much for making this package. My head is melted on a major project at the moment and finding something like this for my final admin screen has been a real relief!

Anyway, I encountered something I wasn't really expecting and then found out how to avoid the issue, so I just thought I should make a note of this here.

If I create an excel (my path is set to a writable folder in the published config) and store it - the output is a huge object full of Recursion notices.

This is a simple test creation I did:

$excel = Excel::create($exportFileName)
        ->sheet('Report')
        ->with(['test', 'test2'])
        ->store('xls');
dd($excel);

I found the store method must have the third parameter (extension) set to true or else it doesn't work. Perhaps it would be good to default the third param to true?

$excel = Excel::create($exportFileName)
        ->sheet('Report')
        ->with(['test', 'test2'])
        ->store('xls', false, true);
dd($excel);

Cheers!
Alex

Path starting Slash issue

Hello! My base_path is '/var/www/whatever' and the line

$path = ltrim($path, '/');

strips the initial slash, so I can't save any file cause I get the usual error "failed to open stream: No such file or directory"

Removing this line solved my issue.

Leading zeros (0) gets removed

Hello!

I want to display, for instance, '0030' but it the leading '00' gets removed and only '30' ends up in the cell.
Is there any way to lock the cell formatting?

I am using 'loadView' if that's of any use.

Thanks for a awesome package!

format the xls output

Hey,
I tried your xls package and it works like a charm!
But I would like to format my table a bit.
It's a normal HTML table and I load it from view.
But my first line in xls is always empty then the table starts...
And how can I set the column width and make something bold?
thanks

A problem when export xlsx format

I'm sorry for my bad english.

When I use export method with xlsx format, it downloaded xls extension.

So, I fix setHeaders method like this.

private function setHeaders()
    {
        // Set the headers
        switch($this->ext)
        {
            case 'xlsx':
                header('Content-type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
                break;

            case 'csv':
                header('Content-type: application/csv');
                break;

            default: // xls
                header('Content-Type: application/vnd.ms-excel');
                break;
        }


        header('Content-Disposition: attachment;filename="' . $this->title . '.'. $this->ext .'"');
        header('Cache-Control: max-age=0');
        header('Cache-Control: max-age=1');
        header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past
        header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); // always modified
        header('Cache-Control: cache, must-revalidate'); // HTTP/1.1
        header('Pragma: public'); // HTTP/1.0
    }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.