Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
mrofia
@mrofia

so the issue is basically when i am trying to convert to pdf. The error got thrown in
$pdfWriter->save($pdfPath)

what is the cause of this issue? the writer for excel file works fine and outputs basically in similar folder hierarchy. So why does the pdfWriter not work? is it something to do with the instance? does phpSpreadsheet prohibits multiple writer instance?

Mark Baker
@MarkBaker
Some of the Writers (like Pdf) might use a temporary folder for partial storage while they are generating the file. The default for this is PHP's upload_tmp_dir if this is set in php.ini (not always defined, particularly if running from the command line), or the system temp directory retrieved b a call to sys_get_temp_dir(). It looks as though access to the system temp directory (/tmp) is restricted.
You can override this default by calling the PDF Writers setTempDir() to provide it with a folder that you do have write access to method before saving
Adrien Crivelli
@PowerKiKi

the system temp directory (/tmp) is restricted

That means your PHP is configured to restrict access. You should either re-configure your PHP, via https://www.php.net/manual/en/ini.core.php#ini.open-basedir, or find a way to tell the writer to write somewhere else

It would seems like you can do that for Tcpdf, before calling the writer, via:
/**
 * Cache directory for temporary files (full path).
 */
define ('K_PATH_CACHE', '/some/path/to/your/writable/directory/');
mrofia
@mrofia

:point_up: June 4, 2021 5:19 PM

Hi Mark, thank you for the insight. You are right, the error boils down to PhpSpreadsheet/Shared/File.php:124
for me i fixed the issue with \PhpOffice\PhpSpreadsheet\Shared\File::setUseUploadTempDirectory(true);
haven't tried your solution with setTempDir on the writer because I am rushed to just make it work, but i think yours might be the cleaner, more proper solution.

my next issue is actually more on performance due to my file having multiple sheet as well as charts, but this is something i can work later. Thanks!

Neri Colon
@ingnrcs
Fatal error: Uncaught Error: Call to private method PhpOffice\PhpSpreadsheet\Shared\StringHelper::buildCharacterSets() from context 'autoLoad' in /home/juicyservice/public_html/public/library/PHPExcel/PHPExcel/Autoloader.php:36 Stack trace: #0 /home/juicyservice/public_html/public/library/PHPExcel/PHPExcel.php(33): require() #1 /home/juicyservice/public_html/autocargar.php(24): require_once('/home/juicyserv...') #2 [internal function]: autoLoad->{closure}('PHPExcelStyle...') #3 /home/juicyservice/public_html/Views/usuario/ExportarPagosSinEnviar.php(38): spl_autoload_call('PHPExcelStyle...') #4 /home/juicyservice/public_html/libs/view.php(12): include('/home/juicyserv...') #5 /home/juicyservice/public_html/Controllers/usuario.php(678): view->render('usuario', 'ExportarPagosSi...') #6 /home/juicyservice/public_html/autocargar.php(48): usuario->ExportarPagosSinEnviar('') #7 /home/juicyservice/public_html/index.php(19): autoLoad->cargar('usuario', 'ExportarPagosSi...', '') #8 {main} thrown in /home/juicyservice/public_html/public/library/PHPExcel/PHPExcel/Autoloader.php on line 36
Mark Baker
@MarkBaker
Why are you trying to use a PhpExcel autoloader with PhpSpreadsheet?
1 reply
Bharani Kumar
@bharanikumar:matrix.org
[m]
$spreadsheetObj = new Spreadsheet();
//$sheet = $spreadsheet->getActiveSheet();
$formula = $spreadsheetObj->getActiveSheet()->getCell('A2')->getValue();
Bharani Kumar
@bharanikumar:matrix.org
[m]
use PhpOffice\PhpSpreadsheet\Spreadsheet;
$spreadsheetObj = new Spreadsheet();
$formula = $spreadsheetObj->getActiveSheet()->getCell('A2')->getValue(); i am getting empty value
Mark Baker
@MarkBaker
So what value do you expect to get from a cell in a completely new, empty spreadsheet?
zkenstein
@zkenstein
Hi, Is it possible to read json data and stored as CellValue? I tried many times, but always return empty
5 replies
zkenstein
@zkenstein
How to do calculation in php office? for example I want to calculate A colom within B
zkenstein
@zkenstein
got it
agenerette
@agenerette
Hello everyone! Do any of you happen to know who I'd need to communicate with about licensing/OSS questions and concerns? We're using the PHPOffice/PhpSpreadsheet library in our application and need to be able to show that their are no requirements for making any parts of that app open-source... or, if there are, we would like to determine what needs to be done to address them.
4 replies
whaliim
@whaliim
Hello Everyone. Could someone please assist me with my issue regarding table formatting and sorting?
https://stackoverflow.com/questions/68128848/how-to-keep-table-formatting-when-sorting-table-generated-by-phpspreadsheet
Thanks in advance.
nirikshan
@nirikshan
hay
hey
Is there any one ?
please help me

nirikshan@Nirikshan-Xprin:/opt/lampp/htdocs/wsn-billing$ composer require phpoffice/phpspreadsheet
Using version ^1.18 for phpoffice/phpspreadsheet
./composer.json has been created
Running composer update phpoffice/phpspreadsheet
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

Problem 1

- Root composer.json requires phpoffice/phpspreadsheet ^1.18 -> satisfiable by phpoffice/phpspreadsheet[1.18.0].
- phpoffice/phpspreadsheet 1.18.0 requires ext-gd * -> it is missing from your system. Install or enable PHP's gd extension.

To enable extensions, verify that they are enabled in your .ini files:

- /etc/php/7.4/cli/php.ini
- /etc/php/7.4/cli/conf.d/10-opcache.ini
- /etc/php/7.4/cli/conf.d/10-pdo.ini
- /etc/php/7.4/cli/conf.d/15-xml.ini
- /etc/php/7.4/cli/conf.d/20-calendar.ini
- /etc/php/7.4/cli/conf.d/20-ctype.ini
- /etc/php/7.4/cli/conf.d/20-dom.ini
- /etc/php/7.4/cli/conf.d/20-exif.ini
- /etc/php/7.4/cli/conf.d/20-ffi.ini
- /etc/php/7.4/cli/conf.d/20-fileinfo.ini
- /etc/php/7.4/cli/conf.d/20-ftp.ini
- /etc/php/7.4/cli/conf.d/20-gettext.ini
- /etc/php/7.4/cli/conf.d/20-iconv.ini
- /etc/php/7.4/cli/conf.d/20-json.ini
- /etc/php/7.4/cli/conf.d/20-mbstring.ini
- /etc/php/7.4/cli/conf.d/20-phar.ini
- /etc/php/7.4/cli/conf.d/20-posix.ini
- /etc/php/7.4/cli/conf.d/20-readline.ini
- /etc/php/7.4/cli/conf.d/20-shmop.ini
- /etc/php/7.4/cli/conf.d/20-simplexml.ini
- /etc/php/7.4/cli/conf.d/20-sockets.ini
- /etc/php/7.4/cli/conf.d/20-sysvmsg.ini
- /etc/php/7.4/cli/conf.d/20-sysvsem.ini
- /etc/php/7.4/cli/conf.d/20-sysvshm.ini
- /etc/php/7.4/cli/conf.d/20-tokenizer.ini
- /etc/php/7.4/cli/conf.d/20-xmlreader.ini
- /etc/php/7.4/cli/conf.d/20-xmlwriter.ini
- /etc/php/7.4/cli/conf.d/20-xsl.ini
- /etc/php/7.4/cli/conf.d/20-zip.ini

You can also run php --ini inside terminal to see which files are used by PHP in CLI mode.

I am getting this error while installing this package
how can I solve this issue ?
Mark Baker
@MarkBaker
You make sure that your build of PHP includes the gd extension - https://www.php.net/manual/en/book.image
whaliim
@whaliim
Hello Everyone. Could someone please assist me with my issue regarding table formatting and sorting?
https://stackoverflow.com/questions/68128848/how-to-keep-table-formatting-when-sorting-table-generated-by-phpspreadsheet
Thanks in advance.
Zer0xFF
@Zer0xFF
Hi there, Im trying to use PhpSpreadsheet to create an xlsx sheet with staff checkin/out time, and using cell formating to highlight late/early checkins, though i noticed the conditions dont seem to apply correctly
image.png
on further inspection i found that the conditions might be set incorrectly?
image.png
this is what it looks like when i modify it in MS Excel 2019, note the added =
Mark Baker
@MarkBaker
How are you adding this formatting? Show code!
Zer0xFF
@Zer0xFF

How are you adding this formatting? Show code!

https://gist.github.com/Zer0xFF/24e57a92e3f76eff78170a7c063c6e6b

to make things more odd, it doesnt outright break, it partially works, so not sure what to make of it
also to note, the NA condition works fine, its the '-'/'+' that act up (since these are partial matches)
Kiren S
@kirensiva
Hi,
Hi,
This function $mergedCells = $objWorksheet->getMergeCells(); is always returning empty array why? My excel is having merged cells, but the function seems not working.
Could some one assist me?
Thank You
4 replies
NewSimpleUser
@NewSimpleUser

Hi to all, could someone help me with my issue?
I have this formula:

=IF(OR(WEEKDAY(A16)=1;WEEKDAY(A16)=7;COUNTIF(AE7:AE19;A16)=0);0;IF(SUM(E16;H16;P16)-IF(M16<>"";M16;0)-"08:00">0;"08:00";SUM(E16;H16;P16)-IF(M16<>"";M16;0)))

and functioning when I put directly in excel page, but when I put it via PHP page it return me a failure (corrupted file)
if I break down it into single parts it is ok
when I add: OR(WEEKDAY(A16)=1;WEEKDAY(A16)=7;COUNTIF(AE7:AE19;A16)=0) and IF(M16<>"";M16;0) toghether than generate corrupted file failure

Kiren S
@kirensiva
Hi,
I have 5 sheets and 5000 records in each. Total 25000 records in the excel file. I am getting memory limit error. I am using chunk reader. Is this expected or am I doing wrong? What could be the best solution? Code is here https://stackoverflow.com/questions/68363558/phpspreadsheet-excel-parsing-throwing-500-internal-server-error
NewSimpleUser
@NewSimpleUser
@NewSimpleUser Solved interna error in Cell.php row 272
Kiren S
@kirensiva
When using chunk filter is there any way to load only required rows? Currently it loads required rows and remaining rows (with null values). Is it possible to avoid loading remaining rows with null values?
2 replies
Gabriel Zanetti
@pupi1985

Hi. I'm getting a file from a browser and storing it in a MySQL database as a BLOB. I get the content of the file by executing file_get_contents() before storing it in the database.

Afterwards, I need to process it using PhpSpreadsheet. However, I no longer have the file, but rather the result of running file_get_contents() stored as a BLOB. What is the right way to go? Is there any way to read the contents without a file? Thank you.

2 replies
Parijit Kedia
@ChikuChinki_twitter
Hello,
When reading a worksheet, is it possible to know whether a certain column/cell is of type number
A number maybe a of type decimal, percentage, date etc.
10 replies
Franco Viacava
@snaker:matrix.org
[m]
i need help pls
hey bros
any?
Sonatique
@sonatique
Hello,
I need your help to solve the following issue: I have a given spreadsheet which features some partial cell protection (not created by me, cannot change, don't have password): some cells are not editable at all, while some can have only their content changed (but not format for instance).
I am using PhpSpreadsheet to modify values of some of the editable cells, it works perfectly fine, that's already very nice. I don't explicitely touch anyting regarding protection.
But the issue is: after I save the modified file, the protection is changed in an unexpected way: if I want to manually edit the file using MS Excel, I cannot change any cells, not even those ones I was able to edit before I used PhpSpreadsheet. It seems that the whole content is now edit-protected. The strange thing is that I can still use PhpSpreadsheet to edit content on this new file, but not with Excel.
Is this a known bug? Any workaround? Thanks a lot in advance.
komgrip
@komgrip
Hello, I would like to know how to set translucent background of chart
Franco Viacava
@snaker:matrix.org
[m]
someone knows how I can read the last excel that I upload
pls pl