Witajcie,
Piszę sobie skrypt eksportu danych do Excela. W tym celu korzystam z gotowej biblioteki: export-xls.class.php. Napisałem funkcję zgodnie z przykładem, która wywołuje się po kliknięciu w link:
Kod PHP:
function BL_RefereeExcel($option){
#include the export-xls.class.php file
require('include/export-xls.class.php');
$filename = 'test.xls'; // The file name you want any resulting file to be called.
#create an instance of the class
$xls = new ExportXLS($filename);
#lets set some headers for top of the spreadsheet
#
$naglowek = "Test Spreadsheet"; // single first col text
$xls->addHeader($naglowek);
#add blank line
$naglowek = null;
$xls->addHeader($naglowek);
#add 2nd header as an array of 3 columns
$naglowek[] = "Name";
$naglowek[] = "Age";
$naglowek[] = "Height";
$xls->addHeader($naglowek);
# Lets add some sample data
#
# Of course this can be from a SQL query or anyother data source
#
#first line
$row[] = "Jack";
$row[] = "24";
$row[] = "6ft 5";
$xls->addRow($row);
#second line
$row = array();
$row[] = "Jim";
$row[] = "22";
$row[] = "5ft 5";
$xls->addRow($row);
#add a multi dimension array
$row = array();
$row[] = array(0 =>'Jess', 1=>'54', 2=>'4ft');
$row[] = array(0 =>'Luke', 1=>'6', 2=>'2ft');
$xls->addRow($row);
# You can return the xls as a variable to use with;
# $sheet = $xls->returnSheet();
#
# OR
#
# You can send the sheet directly to the browser as a file
#
$xls->sendFile();
}
Tylko że do pliku dodają się nagłówki - śmieci <style> z joomli:
Kod:
<style> |
|
.etabs_vis{ |
|
float:left; |
|
padding:5px 20px 5px 30px; |
|
margin:1px; |
|
cursor:pointer; |
|
background-color:#cfcfcf; |
|
border:1px solid #cfcfcf; |
|
background-repeat:no-repeat; |
|
background-position:5px 5px; |
|
color:#333; |
} |
|
.etabs_hide{ |
|
float:left; |
|
padding:5px 20px 5px 30px; |
|
margin:1px; |
|
cursor:pointer; |
|
background-color:#eee; |
|
border:1px solid #cfcfcf; |
|
background-repeat:no-repeat; |
|
background-position:5px 5px; |
|
color:#333; |
|
|
} |
|
.tabdiv{ |
|
|
border:1px solid #cfcfcf; |
|
padding:7px; |
} |
......... |
Dlaczego? Jak je usunąć?