Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Wynik dzialania skryptu jako zalacznik w Excelu
slmroz
post
Post #1





Grupa: Zarejestrowani
Postów: 10
Pomógł: 0
Dołączył: --
Skąd: Warszawa

Ostrzeżenie: (0%)
-----


Hej!

Wiem, ze ten proble bywal juz po czesci tlumaczony, ale w takiej postaci
jest dla mnie nie do ugryzienia:

Skrypt szuka w bazie informacji, przetwarza je i w efekcie wychodzi tabela,
ktora musze wyslac paru ludzikom mailem jako zalacznik w excelu :? (koniecznie, nie
csv!).

Macie jakies przykladowe skrypty do zasugerowania (albo rady...(IMG:http://forum.php.pl/style_emoticons/default/smile.gif) )?

Sławek
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
kryr
post
Post #2





Grupa: Zarejestrowani
Postów: 268
Pomógł: 0
Dołączył: --
Skąd: kielce

Ostrzeżenie: (0%)
-----


przyklad z php.net:

Kod
<?php

    print "Hi";

#Instantiate the spreadsheet component.

#    $ex = new COM("Excel.sheet") or Die ("Did not

connect");

$exapp = new COM("Excel.application") or Die ("Did not

connect");



#Get the application name and version    

print "Application name:{$ex->Application->value}";

print "Loaded version: {$ex->Application->version}";



$wkb=$exapp->Workbooks->add();

#$wkb = $ex->Application->ActiveWorkbook or Die ("Did not open

workbook");

print "we opened workbook";



$ex->Application->Visible = 1; #Make Excel visible.

print "we made excell visible";



$sheets = $wkb->Worksheets(1); #Select the sheet

print "selected a sheet";

$sheets->activate; #Activate it

print "activated sheet";



#This is a new sheet

$sheets2 = $wkb->Worksheets->add(); #Add a sheet

print "added a new sheet";

$sheets2->activate; #Activate it

print "activated sheet";



$sheets2->name="Report Second page";



$sheets->name="Report First page";

print "We set a name to the sheet: $sheets->name";



# fills a columns

$maxi=20;

for ($i=1;$i<$maxi;$i++) {

    $cell = $sheets->Cells($i,5); #Select the cell (Row Column number)



    $cell->activate; #Activate the cell

    $cell->value = $i*$i; #Change it to 15000

}



$ch = $sheets->chartobjects->add(50, 40, 400, 100); # make a

chartobject



$chartje = $ch->chart; # place a chart in the chart object

$chartje->activate; #activate chartobject

$chartje->ChartType=63;

$selected = $sheets->range("E1:E$maxi"); # set the data the

chart uses

$chartje->setsourcedata($selected); # set the data the chart uses

print "set the data the chart uses ";



$file_name="D:/apache/Apache/htdocs/alm/tmp/final14.xls";

if (file_exists($file_name)) {unlink($file_name);}

#$ex->Application->ActiveWorkbook->SaveAs($file_name); # saves

sheet as final.xls

$wkb->SaveAs($file_name); # saves sheet as final.xls

print "saved";



#$ex->Application->ActiveWorkbook->Close("False");    

$exapp->Quit();

unset($exapp);

?>
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 30.09.2025 - 07:51