Closed adigoun2005 closed 8 years ago
Hi @adigoun2005
I see no $container
variable in your code, so it is somewhere else. Can you please provide full error trace to give an insight?
Also if this is snippet of Symfony controller, you should do return $response;
at the very end instead of $response->send();
Hello, I am experiencing this issue! I am very new with symfony. I just installed your bundle and was trying to test the very first sample code you wrote. I am using symfony4.
I need it to be in a Command class
$reader = $this->getContainer()->get('arodiss.xls.reader');
$content = $reader->readAll("C:/ArticlesInterior.xlsx");
var_dump($content);
Looks like I need to declare it in parameters.yaml
, but I don't know what class
I have to use, as no code was downloaded to my vendor
folder with the composer installation.
arodiss.xls.reader:
class: ''
public: true
Thank you very much @arodiss!
Hello @alarcia One probable reason is that you did not register bundle in your application. I did not yet work with Symfony 4, but looks like in order to do it you have to add bundle in your 'config/bundles.php`
Hello I thank you for this bundle I am actually facing an issue i hope you can help me After the installation i am getting this error
Notice: Undefined variable: container
Here is my code
$em = $this->getDoctrine()->getManager();
$requested = $em->getRepository('UserBundle:User')->byRegister();
$writer = $this->get("arodiss.xls.writer.buffered"); $writer->create("futursVendeurOORUKA.xls", array("Nom d'utilisateur", "Nom","Prenoms","Email","Commune","Adresse","Complement","Telephone")); //second argument represents first row
foreach ($requested as $rq) { $writer->appendRow("users.xls", array($rq->getUser(), $rq->getUser()->getAdresses()->last()->getNom(), $rq->getUser()->getAdresses()->last()->getPrenoms(), $rq->getUser()->getEmail(), $rq->getUser()->getAdresses()->last()->getCommune(), $rq->getUser()->getAdresses()->last()->getAdresse(), $rq->getUser()->getAdresses()->last()->getComplement(), $rq->getUser()->getAdresses()->last()->getTelephone())); } $response = new Response(); $response->headers->set("Content-Type", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); $response->headers->set("Content-Disposition", "attachment;filename=excelfile.xlsx"); $response->setContent(file_get_contents($file)); $response->send();