|
![Picture of V P Picture of V P](/graphics/unknown.gif) V P - 2013-08-07 07:51:56
Hello,
I am looking for more information about this class.
Link http://www.omnihost.co.nz/ returns no documentation.
Do you provide a complete documentation?
Can you put an example with all the page in php? (with includes, Requires)
And folder structure of your site.
I created a folder BasicExcel by putting all the files in the archive.
I took the example of creating an xsl file in the include file xsl.php and AbstractWriter.php.
But he said he does not know the Xsl class.
"Fatal error: Class 'BasicExcel\Writer\Xsl' not found"
Here is my code:
require_once("BasicExcel/AbstractWriter.php");
require_once("BasicExcel/Writer/Xls.php");
$data = array(
array('Nr.', 'Name', 'E-Mail'),
array(1, 'Jane Smith', 'jane.smith@fakemail.com'),
array(2, 'John Smith', 'john.smith@fakemail.com'));
try {
$csvwriter = new \BasicExcel\Writer\Xsl();
$csvwriter->fromArray($data);
$csvwriter->download('myfilename.csv');
}catch(Exception $e){
echo $e->getMessage();
exit;
}
Thank you
![Picture of V P Picture of V P](/graphics/unknown.gif) V P - 2013-08-07 08:48:43 - In reply to message 1 from V P
It's ok.
I have my xls file to create.
I made ​​changes because I could not handle spaces "namespace".
Thank you for this class.
![Picture of Jaime Sanchez Picture of Jaime Sanchez](/graphics/unknown.gif) Jaime Sanchez - 2013-08-07 15:54:07 - In reply to message 2 from V P
did it worked for you??
I tried that i got the workbook with this line:
"Filename mimetype must be .xml or .xls"
![Picture of V P Picture of V P](/graphics/unknown.gif) V P - 2013-08-07 21:01:00 - In reply to message 3 from Jaime Sanchez
Yes it works for me.
But after a few changes in the code.
I'm just used me for export now.
I remove all the "namespaces" files.
I used the traditional classes.
it's my code:
AbstractWriter.php
<?php
Class AbstractWriter {
protected $handle;
public function writeFile($filename) {
$this->handle = @fopen($this->filename($filename
…..
Writer / Xls.php
<?php
class Xls extends AbstractWriter {
/**
* MicrosoftXML Header for Excel
* @var string
*/
const sHeader = "<?xml version=\"1.0\" encoding=\"%s\"?\>\n<Workbook xmlns=\"urn:schemas-microsoft-com:office:spreadsheet\" xmlns:x=\"urn:schemas-microsoft-com:office:excel\" xmlns:ss=\"urn:schemas-microsoft-com:office:spreadsheet\" xmlns:html=\"http://www.w3.org/TR/REC-html40\">";
/**
* MicrosoftXML Footer for Excel
* @var string
*/
…..
main.php
<?php
Require_once(“AbstractWriter.php”);
Require_once(“Writer/Xls.php”);
$data = array(
array(
array('first', 'second', 'third'),
array(‘first test, 'second test', 'third test'),
array(123, 456, 789)
)
);
try {
$writer = new Xls();
$writer->fromArray($data);
$writer->download($MyFilename);
}catch(Exception $e){
echo $e->getMessage();
exit;
}
With this code I can generate my xls file without problems.
![Picture of Craig Smith Picture of Craig Smith](/picture/user/608499.jpg) Craig Smith - 2013-08-20 21:20:17 - In reply to message 4 from V P
We are working on example files and documentation
the classes are used in a large project we are working on and undergoing fixes / updates as we finalise this section.
![Picture of Solange Picture of Solange](/graphics/unknown.gif) Solange - 2014-01-21 18:57:51 - In reply to message 5 from Craig Smith
don't work for export to xlsx :(, Excel say "the file is damage2 :(
![Picture of Sandy Johnson Picture of Sandy Johnson](/graphics/unknown.gif) Sandy Johnson - 2014-04-23 09:13:24 - In reply to message 1 from V P
I am looking to import data from Xlsx file. Please can you give me an example of how to do that? I have tried using the examples in "README.md", but throws the error "Class '\BasicExcel\Reader\Xls' not found in......."
Please reply and provide an example of how to import data from xlsx file.
Thanks,
Sandy Johnson
|