Comments (4)
I confirm that the following code wil output an xlsx with an image, but an xls without an image (assuming a test.jpg
beside the script) as seen in LibreOffice 5:
<?php
require __DIR__ . '/vendor/autoload.php';
$spreadsheet = new PhpOffice\PhpSpreadsheet\Spreadsheet();
$drawing = new PhpOffice\PhpSpreadsheet\Worksheet\Drawing();
$drawing->setPath('test.jpg');
$drawing->setWorksheet($spreadsheet->getActiveSheet());
$writer = new PhpOffice\PhpSpreadsheet\Writer\Xlsx($spreadsheet);
$writer->save('test.xlsx');
$writer = new PhpOffice\PhpSpreadsheet\Writer\Xls($spreadsheet);
$writer->save('test.xls');
Unfortunately I won't have time to investigate further. But if you could determine exactly what commit broke the feature, it would be very helpful.
from phpspreadsheet.
I found strange place when debug this problem in PhpOffice\PhpSpreadsheet\Writer\Excel5:
Switch never execute any switch block because expected that class will start with "\" in but class name start from latin character. I guess it can be reason of this issue but not check it.
from phpspreadsheet.
I checked it, drawing now attached.
Submited PR with fix: #61
from phpspreadsheet.
My need is same, I have tried from view with html img tag but it does not worked. then I have tried below methods :
public static function beforeSheet(BeforeSheet $event) {
$drawing = new Drawing();
$drawing->setPath(public_path('sent_files/35/100_1521622088/35_final_card.png'));
$drawing->setCoordinates('A3');
$drawing->setWidth(150);
$drawing->setHeight(100);
$drawing->setWorksheet($event->sheet);
}
I am getting bellow error :
Type error: Argument 1 passed to PhpOffice\\PhpSpreadsheet\\Worksheet\\BaseDrawing::setWorksheet() must be an instance of PhpOffice\\PhpSpreadsheet\\Worksheet\\Worksheet or null, instance of Maatwebsite\\Excel\\Sheet given, called in /php_projects/my-details/app/Exports/ReportDataFromSbExport.php on line 113
from phpspreadsheet.
Related Issues (20)
- setReadDataOnly function is deprecated or missing HOT 4
- Including WordPress? HOT 4
- If the content of the csv file contains Chinese characters enclosed in double quotes, the data will not be output correctly HOT 4
- Need help regarding download of excel file. HOT 1
- Protect Sheet But Allow Sort not working HOT 2
- [ERROR] Class "Rector\Core\Rector\AbstractRector" not found HOT 2
- Make voku packages optional HOT 2
- ver 1.29 ) Csv auto_detect_line_endings HOT 4
- Unable to save with setFormatCode in ODS, and getFormatCode from existing documents HOT 4
- mime_content_type() has been removed since PHP ver. 8 HOT 1
- Some methods removed in v2.0 but not mentioned in CHANGELOG file HOT 1
- syntax error in xls.php file HOT 2
- giao dịch đồng thời php HOT 2
- Uncaught TypeError: PhpOffice\PhpSpreadsheet\Writer\Xlsx\Chart::writePlotGroup(): Argument #6 ($plotGroupingType) must be of type string, null given
- Chart: Y axis is no longer displayed after load and save HOT 1
- Microsoft excel files of different version do not read files HOT 1
- Leap year calculation correction HOT 2
- rangeToArray tries to read every possible cell leading to OOM HOT 1
- Error on StringValueBinder `convertFormula` check HOT 2
- Excel does not seem to respect any value used in a table column's setShowFilterButton() method HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from phpspreadsheet.