No..nessun errore... ma non converte nulla. Cosa dovrei modificare?
No..nessun errore... ma non converte nulla. Cosa dovrei modificare?
io ho usato questo https://phpexcel.codeplex.com/wikipa...Title=Examples molto carino
IP-PBX management: http://www.easypbx.it
Old account: 2126 messages
Oldest account: 3559 messages
Si ma come adatti il tutto al mio problema? La soluzione di camionistaxcaso mi sembra perfetta, bisogna soltanto modificare qualcosa...![]()
E se metti un exit cosi?
codice:<?php if(isset($_POST["action"]) and $_POST["action"] == "go"){ $filename="file.xls"; header ("Content-type:application/vnd.ms-excel"); header ("Content-Disposition: attachment; filename=$filename"); exit; } ?> <table summary="<?php echo htmlspecialchars($this->data->dmname)?>" cellspacing="0" > <?php if($this->theme->conf->details_name) : ?> <tr> <td> <strong> <?php echo _DML_TPL_NAME ?>: </strong> </td> <td> <?php echo htmlspecialchars($this->data->dmname) ?> </td> </tr> <?php endif;if($this->theme->conf->details_name) : ?> <tr> <td> <strong> <?php echo _DML_TPL_CIG ?>:</strong> </td> <td> <?php echo $this->data->dmcig ?> </td> </tr> <?php endif; if($this->theme->conf->details_name) : ?> <tr> <td> <strong><?php echo _DML_TPL_SOG ?>:</strong> </td> <td><?php echo $this->data->dmsog ?></td> </tr> <?php endif; ?> </tbody> </table> <form action="?"> <input type="hidden" value="go" name="action"> <input type="submit" value="Scarica in formato xls"> </form>
Nientenon mi converte nulla.
![]()
Ragazzi ma perche' cosi' mi converte tutta la pagina e non solo la tabella? Io non capisco dove sbaglio
codice:<?php // nome del file che creeremo $filename="prova.xls"; header ("Content-Type: application/vnd.ms-excel"); header ("Content-Disposition: attachment; filename=$filename");?> <table summary="<?php echo htmlspecialchars($this->data->dmname)?>" cellspacing="0" > if($this->theme->conf->details_name) : ?> <tr><td><strong><?php echo _DML_TPL_NAME ?>:</strong></td><td><?php echo htmlspecialchars($this->data->dmname) ?></td></tr> <?php endif; if($this->theme->conf->details_name) : ?> <tr><td><strong><?php echo _DML_TPL_PROT ?>:</strong></td><td><?php echo $this->data->dmprot ?></td></tr><?php endif; if($this->theme->conf->details_downloads) : ?> <tr><td><strong><?php echo _DML_TPL_LASTUP ?>:</strong></td><td><?php $this->plugin('dateformat', $this->data->dmlastupdateon , _DML_TPL_DATEFORMAT_LONG); ?></td></tr><?php endif; ?></tbody></table> <div class="clr"></div> </div> <?php if(JRequest::getString('tmpl') != 'component') :?> <div class="dm_taskbar <?php echo @$this->theme->conf->style ? 'dm_dark' : 'dm_light'; ?>"> <ul> <?php unset($this->buttons['details']); $this->doc = &$this; include $this->loadTemplate('documents'.DS.'tasks.tpl.php'); ?> <li><a href="javascript: history.go(-1);"><?php echo _DML_TPL_BACK ?></a></li> </ul> </div> <?php endif; ?> <div class="clr"></div> </table> </body></html>
Ripeto, anche a me dava quel problema li. Tentavo di scaricare un file pdf con le funzioni header e il risultato del file scaricato era il file stesso + il contenuto della pagina, avevo risolto semplicemente mettendo
if isset $_GET["var"] -> esegui il download
else -> mostra il contenuto della pagina
La differenza tra te e me è che tu il file lo crei, io invece lo avevo già pronto da scaricare. Potrebbe essere li l' inghippo?
Ciao ragazzi per la conversione in csv e xls ho risolto con ExcellentExport di javascript:
<a download="<?php echo $nome; ?>.xls" href="#" onclick="return ExcellentExport.excel(this, 'table', 'Sheet Name Here');">
<button>EXCEL</button></a></li>
Ma per convertire questa tabella in xml?? Esistono delle estensioni? Dovrei fare la stessa identica cosa: creare un pulsante per estrarre un file xml...Ho letto di SimpleXML o DOM XML...
Grazie