-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Drawing() setPath does not work with special characters #1470
Comments
Hi! I checked the situation you've described out and I'm shure it's not a PhpSpreadsheet's bug. PhpSpreadsheet doesn't change such filenames in writing methods because it's your (as a programmer) responsibility to provide a correct filenames. I think you could add a little code to bring the file names to an acceptable format. Close #1470 |
That’s totally fine.
Thanks for clearing that up. It’s a great class by-the-way.
Actually… may I be cheeky (whilst you’re here). I have a question to do with very large datasets. We have one report that can be very big – and we constantly run into memory problems with it. Is there a way to save partial sheets and then stitch them together at the end?
Kind regards
Duncan Claridge
Web Developer
BIG GROUP Retail
Switch: +44 (0) 1635 524055
The Big Barn, Hambridge Farm,
Hambridge Road, Newbury RG14 2QG
Registered in England: 2581201
www.biggroup-retail.co.uk<https://eur02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.biggroup-retail.co.uk%2F&data=02%7C01%7Cduncan.claridge%40biggroup.co.uk%7C78cac0a6c57a412228a708d7c7392e4c%7Ce1bfdd245a6a4babb0cf3629b731cf05%7C0%7C0%7C637196920717052202&sdata=sL%2BcuINk4VWNTsCPfhEzD26oWJ1PjC0ygUpVI2LSFG4%3D&reserved=0>
From: Vagir <[email protected]>
Reply to: PHPOffice/PhpSpreadsheet <[email protected]>
Date: Wednesday, 13 May 2020 at 23:09
To: PHPOffice/PhpSpreadsheet <[email protected]>
Cc: Duncan Claridge <[email protected]>, Author <[email protected]>
Subject: Re: [PHPOffice/PhpSpreadsheet] Drawing() setPath does not work with special characters (#1470)
Hi!
I checked the situation you've described out and I think it's not a PhpSpreadsheet's bug.
MS Excel doesn't allow drawing's (and not only drawing's, I suppose) filenames to include symbol '#'.
So, when an opened XLSX-file contains an incorrect filename, Excel raises an error.
PhpSpreadsheet doesn't change such filenames in writing methods because it's your (as a programmer) responsibility to provide a correct filenames.
I think you could add a little code to bring the file names to an acceptable format.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FPHPOffice%2FPhpSpreadsheet%2Fissues%2F1470%23issuecomment-628271724&data=02%7C01%7Cduncan.claridge%40biggroup.co.uk%7C9696955266554bc258d408d7f78a5353%7Ce1bfdd245a6a4babb0cf3629b731cf05%7C0%7C0%7C637250045788279918&sdata=M1R1XhI3o6ptkNaIz80CxFaX080qTHVoO5uJileoOy0%3D&reserved=0>, or unsubscribe<https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAMZB7UB2ND5RKV2OKYQ3OKLRRMLB7ANCNFSM4M673TWA&data=02%7C01%7Cduncan.claridge%40biggroup.co.uk%7C9696955266554bc258d408d7f78a5353%7Ce1bfdd245a6a4babb0cf3629b731cf05%7C0%7C0%7C637250045788279918&sdata=9woSw4fpwMvyrjSGcDVP%2BXzfXfs5Q28gYS%2FPoPcVe9o%3D&reserved=0>.
…________________________________
[https://4cfd57cc5319aabff957-7580f4311a891d55ec49d9d0c5f231ec.ssl.cf3.rackcdn.com/Banner/Email_banners_V0.2.jpg]
This e-mail message and any attachment(s) is for use by the addressee(s) only and any information that it contains is privileged, confidential or exempt from disclosure under applicable law. If the message is received by anyone other than the intended recipient(s), please inform the sender immediately and then delete all copies of the message from your computer. You are prohibited from retaining, distributing, disclosing or using any information contained herein.
The contents of this email, and any attachment(s) contained herein, do not necessarily represent the views of the Big Group. Whilst all reasonable care has been taken to avoid the transmission of viruses, it is the responsibility of the recipient to ensure that the onward transmission, opening or use of this message and any attachments will not adversely affect its systems or data. No responsibility is accepted by the sender in this regard and the recipient should carry out such virus and other checks as it considers appropriate.
Thank you for your cooperation.
|
Thanks! I'm glad to help.
I think the solution of the memory problem depends very much on exactly where in the code it happens. Unfortunately, it's hard to say anything useful without analyzing your code. But for now I don't see any reason why your large report cannnot be created step by step and then merged into a single document. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
If the problem with "#" in image filename ist still interesting here is a quick solution:
That's it. Now Excel find the image and open correctly without faults. |
Fix PHPOffice#2415. Fix PHPOffice#1470. If path name of image contains anything other than ASCII, or if it contains # or space or probably other exceptions, PhpSpreadsheet creates a file that Excel cannot, for whatever reason, read (it is valid xml). When adding an image to a spreadsheet, Excel does not retain the original path name; PhpSpreadsheet does, but probably shouldn't. It is changed to save the image file in the zip as the MD5 hash of the original path name. This produces a file that Excel can read. In addition, it ensures that, if the image is used in multiple places, it is saved in the Excel file only once. Because this error becomes evident only when opening the file in Excel, it is difficult to write a test case. I have instead duplicated sample Basic/05... using image files whose names match the reported error conditions.
* Special Characters in Image File Name Fix #2415. Fix #1470. If path name of image contains anything other than ASCII, or if it contains # or space or probably other exceptions, PhpSpreadsheet creates a file that Excel cannot, for whatever reason, read (it is valid xml). When adding an image to a spreadsheet, Excel does not retain the original path name; PhpSpreadsheet does, but probably shouldn't. It is changed to save the image file in the zip as the MD5 hash of the original path name. This produces a file that Excel can read. In addition, it ensures that, if the image is used in multiple places, it is saved in the Excel file only once. Because this error becomes evident only when opening the file in Excel, it is difficult to write a test case. I have instead duplicated sample Basic/05... using image files whose names match the reported error conditions. * Scrutinizer Minor Error Remove some newly dead code.
This is:
What is the expected behavior?
The .xlsx file should open normally and display any added images.
What is the current behavior?
When attempting to open the file, you see an 'Alert' popup saying 'We found a problem with some content in MyFileName.xlsx'.
What are the steps to reproduce?
Use an image file that has a '#' in the filename.
Please provide a Minimal, Complete, and Verifiable example of code that exhibits the issue without relying on an external Excel file or a web server:
Which versions of PhpSpreadsheet and PHP are affected?
I'm using PHP 7.3 and the version of PhpSpreadsheet is 1.9.0 2019-08-17
The text was updated successfully, but these errors were encountered: