Comments (5)
Hi jochenhilgers
you should create a new StreamWriter the most silimar is FileWriter
https://github.com/liuggio/Symfony2-StreamResponse/blob/master/FileWriter.php
<?php
namespace n3b\Bundle\Util\HttpFoundation\StreamResponse;
use Symfony\Component\HttpFoundation\File\File;
/**
* Description of FileWriter
*
* @author neb
*/
class FileWriter implements StreamWriterInterface
{
protected $file;
public function __construct($path = null)
{
$this->file = new File($path);
}
public function write()
{
$this->file->openFile()->fpassthru();
}
public function getFile()
{
return $this->file;
}
}
from excelbundle.
Hi jochenhilgers
you should modify the FileWriter, adding a setFile
https://github.com/liuggio/Symfony2-StreamResponse/blob/master/FileWriter.php
something like:
<?php
namespace n3b\Bundle\Util\HttpFoundation\StreamResponse;
use Symfony\Component\HttpFoundation\File\File;
/**
* Description of FileWriter
*
* @author neb
*/
class FileWriter implements StreamWriterInterface
{
protected $file;
public function __construct($path = null)
{
if !null ...
$this->file = new File($path);
}
function setPath ...
}
Then you should modify the
https://github.com/liuggio/ExcelBundle/blob/master/Resources/config/services.yml
adding 2 new services
xls.stream_writer_file_xls5:
#similar to xls.stream_writer_output_xls5:
#service to call
xls.service_xls5_to_file:
class: %xls.service.class%
arguments: [@xls.phpexcel, @xls.stream_writer_file_xls5, %xls.stream_response.class%]
What do you think?
from excelbundle.
In the action this would look like this?
$xlsService = $this->get('xls.service_xls5');
...
$xlsService->getStreamWriter()->setPath( time().'_foo.xls' );
$xlsService->getStreamWriter->write();
Alternatively we could extend the StreamWriterInterface->write() and StreamWriterWrapper->write() with some conditonal parameter:
public function write( $stream=null );
For me this seems to be more intuitive...what do you think?
from excelbundle.
good option as well!
from excelbundle.
I added the parameter: liuggio/Symfony2-StreamResponse#1
from excelbundle.
Related Issues (20)
- Trying to install luiggio when having symfony 2.5.12 HOT 1
- 1000 rows limit HOT 1
- Bundle Installation HOT 3
- can not install excelbundle HOT 1
- How to use the bundle HOT 2
- In this bundle compatible with SF3? HOT 2
- How to insert database data in ExcelBundle
- Can you set a field type?
- How to read cyrillic characters?
- How to get file from createPHPExcelObject() HOT 1
- Find a better name than "Factory" ?
- liuggio/ExcelBundle is not support for excel 2010 ?
- Notice: A non well formed numeric value encountered for PHP 7.1 HOT 1
- ExcelBundle on Symfony 4.0 HOT 6
- ExcelBundle takes 50 seconds in generate 1 row excel document
- Deprecation since 3.3 and break at 4.0 HOT 6
- getCalculatedValue doesn't work when formula has accent
- Package phpoffice/phpexcel is abandoned, you should avoid using it HOT 2
- Use Drawing HOT 1
- Styles are not applied
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 excelbundle.