php - Box/Spout questions -
this first time using box/spout library. using wamp server.
question following:
require_once('./spout-master/src/spout/autoloader/autoload.php'); use box\spout\writer\writerfactory; use box\spout\common\type; $filepath = 'test.xlsx'; $writer = writerfactory::create(type::xlsx); $writer->opentofile($filepath); [x] $writer->addrow(['a'], $style); $writer->close();
(1)
when running above code, following error message:
warning: rmdir(c:\windows\temp/xlsx560f58d588ceb): permission denied in c:\wamp\www\1300.revenue.com.my\public_html\spoutmaster\src\spout\common\helper\filesystemhelper.php on line 113
what errors means , how should modify prevent error message appeared?
(2) want make expected output below:
but didn't know how write on [x] part. how write in order expected output?
it looks default temp folder used generate xlsx file cannot deleted. can verify checking permissions on c:\windows\temp/xlsx560f58d588ceb
.
to solve issue, can either manually fix permissions on temp folder (c:\windows\temp
) or use temporary folder, specified here: https://github.com/box/spout#using-custom-temporary-folder
regarding 2), there no straightforward way whith spout. spout not support merging cells. thing can is:
| 1 | 2 | | 3 | | |---|---|---|---|---| | | | b | | b | |---|---|---|---|---|
or alternatively (if makes more sense):
| 1 | 2 | 2 | 3 | 3 | |---|---|---|---|---| | 1 | | b | | b | |---|---|---|---|---|
either way, you'll have format rows shown above: [[1,2,'',3',''], ['', 'a','b','a','b']]
or [[1,2,2,3,3], [1, 'a','b','a','b']]
Comments
Post a Comment