-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Support Drawing in cell Read & Write #4677
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
src/PhpSpreadsheet/Reader/Xlsx.php
Outdated
| $objDrawing->setOffsetX(0); | ||
| $objDrawing->setOffsetY(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
those can be remove as it is by default as 0
|
I am sorry I have not been able to give this the attention it needs till now. At any rate, for starters, what is the difference between the two new files named drawing_in_cell.xlsx? If there is no difference, can you remove one of them? If there is a difference, can you rename one of them? We allow name conflicts like this, but, on a big change like this one, I find it too confusing. I will also mention that I am getting an "invalid image" message on one of my systems when I try to open those files. It seems to open okay anyhow, and, when I try it on a machine with different software, the error message doesn't happen. So, the error is far more likely to be with my system than with your file, but I at least need to ask if you are aware of anything "funny" about the images you are using? Can you tell me what they are, and where I am supposed to find them on the spreadsheets? Do you allow for the possibility of embedded and non-embedded images on the same worksheet? What about using both embedded and non-embedded for the same image on the same worksheet? |
|
You have already some comments to issue #4280. Please take a look at one of the spreadsheets uploaded there. <recoveryLog>
<logFileName>error205120_01.xml</logFileName>
<summary>
Errors were detected in file 'C:\git\issue.4280.nopw.3.xlsx'
</summary>
<repairedRecords>
<repairedRecord>
Repaired Records: Cell information from /xl/worksheets/sheet40.xml part
</repairedRecord>
<repairedRecord>
Repaired Records: Cell information from /xl/worksheets/sheet46.xml part
</repairedRecord>
<repairedRecord>
Repaired Records: Cell information from /xl/worksheets/sheet48.xml part
</repairedRecord>
<repairedRecord>
Repaired Records: Cell information from /xl/worksheets/sheet49.xml part
</repairedRecord>
</repairedRecords>
</recoveryLog>I am not sure offhand what sheets 40, 46, 48, and 49 are. I will try to do more research. But we do not see these messages when using the production version of PhpSpreadsheet to load and save, so it is possible that your code has introduced these problems. The spreadsheet is very complicated, so resolving these problems isn't necessarily something I need your change to be able to do, but it might be. |
|
Here are the affected sheets: |
Support for read & write of Image in Cell - Related to #4014
I must admit it was really complex to understand the relations between all xml (richData) files that have to be created / updated. I lost a lot of time comparing the structure with files edited in Excel and specifically figuring out the
metadata.xmlfile had to be largely changed as soon as images are added in cells.This branch is based on #4664
This is:
Checklist:
Support for read and write of Image in Cell - Related to #4014
Why this change is needed?
When an image is inserted in a cell in an XLSX document, PhpSpreadsheet is currently not able to read it. This PR allow to collect those images in order to find them when calling
$objWorksheet->getInCellDrawingCollection(). It's also possible to get the Drawing object from from the related Cell.The code is covered by tests and have been tested in real application - As shown bellow:

When I import the file with image inserted in the Cell, I have it now in $objWorksheet->getInCellDrawingCollection():