Archiv verlassen und diese Seite im Standarddesign anzeigen : PHP und EXCEL?
Hi,
sorry dass ich das tun muss, php und excel in einem topic zu verwenden ist ja schon schlimm genug...
naja, trotz dessen brauch ich funktionen um excel zu steuern, d.h. ich hab ein sheet, in das ich daten einlesen will, von php aus...
geht das?
thx
ich hab eben was änliches mit asp gemacht:
ich hab einfach den mime type auf excel geändert und die detailformatierungen mit den mso-css gemacht.
die css machst am einfachsten so, dass du ne exceldatei richtig formatierst und dann als html speicherst, dann kannst das auslesen
in asp sieht das mitm mime-type so aus:
<% Response.ContentType = "application/vnd.ms-excel"; %>
wobei das vnd. dafür steht, dass der IE das gleich inegriert in nem IE fenster auftut, ansonsten kommt der download dialog.
ich hab auf phpbuilder.org was aehnliches gefunden:
<?php
require_once("../includes/deliveryfmt_functions.php"); # Load the library
deliveryfmt_initialize(); # Initialize the library
deliveryfmt_set_format(´xls´, false); # Select Excel (.xls) formatting
header(´Content-Type: ´.deliveryfmt_mimetype()); # MIME-type
header(´Content-Disposition: attachment;filename="results.´.deliveryfmt_format_extension().´"´); # Try to name the output file
header(´Expires: Mon, 26 Jul 1997 05:00:00 GMT´); # Date in the past
header(´Last-Modified: ´.gmdate("D, d M Y H:i:s").´ GMT´); # always modified
$nocache = ´Cache-Control: no-cache´; # HTTP/1.1
if ($SERVER_PROTOCOL == ´HTTP/1.0´) { $nocache = ´Pragma: no-cache´; } # HTTP/1.0
header($nocache);
header(´Content-Transfer-Encoding: binary´); # Binary data
deliveryfmt_header(); # Set up file header
# Two different ways of using the functions. One way is to set the column names,
# then just pass in array rows of data:
$colnames = array(1=>´banana´, 2=>´apple´, 3=>´pear´);
deliveryfmt_set_column_names($colnames);
$data = array(´banana´=>´whatever´, ´apple´=>´you´, ´pear´=>´like´);
deliveryfmt_put_array($data);
$data = array(´banana´=>´foo´, ´apple´=>´3.14159265´, ´pear´=>´2´);
deliveryfmt_put_array($data);
$data = array(´banana´=>´bar´, ´apple´=>´Mac´, ´pear´=>´Bartlet´);
deliveryfmt_put_array($data);
# The second way is to create a two dimensional array and have the library
# do most of the work:
# $data = array(´first´=>array(´banana´=>´whatever´, ´apple´=>´you´, ´pear´=>´like´),
# ´second´=>array(´banana´=>´foo´, ´apple´=>´3.14159265´, ´pear´=>´2´),
# ´third´=>array(´banana´=>´bar´, ´apple´=>´Mac´, ´pear´=>´Bartlet´));
# deliveryfmt_put_2d_array($data);
deliveryfmt_trailer(); # Add file trailer
$buffer = deliveryfmt_finish(); # Finish up the Excel file and return the contents
echo $buffer; # Send it to the waiting browser
?>
leider funtzt das aber nich so richtig... muss mal schauen dass ich das hinbekomme... die daten sollen spaeter in eine vorlage kopiert werden... ?(
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.