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)
- 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
- Record locking in mysqlsever? help!!!!!! HOT 2
- failed to open stream: Permission denied on line 178 of /var/cbi/framework/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/BaseWriter.php
- SET TRANSACTION ISOLATION LEVEL SERIALIZABLE in php?!! help me!!!!!!!!!! HOT 2
- Error: Typed property PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::$parent must not be accessed before initialization HOT 1
- Chart: Not able to use multiple bar types (DataSeries::TYPE_BARCHART) in a single chart.
- Checking and converting loaded content in HTML Reader based on charset HOT 7
- Php 7.1 doesn't work with 1.11 and 1.12 versions (at least) HOT 1
- ZipStream error HOT 1
- Not able to write an xlsm file - phpoffice phpspreadsheet version 1.25.2 HOT 1
- Xml::loadSpreadsheetFromString() tries to open file when using falsy argument
- XML-Readers: Border Specification
- XML-Reader: support rich text HOT 1
- XML-Reader: interpret zoom
- PhpSpreadsheet can't retrieve images placed inside cell HOT 1
- Feature request: functionality to detect and read sheet tables and related styles HOT 1
- HTML export ignores setSize / getColor cell formats HOT 5
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.