Missing headers in the Excel Export? Find fix in here…
-
This is my modified version of the exporters file. You should be able to apply the same to the HTML exporter too.
wp-users-exporter/exporters/UE_XLS.class.php
<?php class UE_XLS extends A_UserExporter{ public static function getFileExtension(){ return 'xls'; } public static function getFileExtensionDescription(){ return __('MS Excel Spreadsheet','wp-users-exporter'); } protected function printHeader(){ header('Pragma: public'); header('Cache-Control: no-store, no-cache, must-revalidate'); // HTTP/1.1 header("Pragma: no-cache"); header("Expires: 0"); header('Content-Transfer-Encoding: none'); header('Content-Type: application/vnd.ms-excel; charset=UTF-8'); // This should work for IE & Opera header("Content-type: application/x-msexcel; charset=UTF-8"); // This should work for the rest header('Content-Disposition: attachment; filename='.$this->filename.'.xls'); echo '<table><tr>'; foreach ($this->descriptions as $coldesc) { echo "<th>".htmlentities(utf8_decode($coldesc))."</th>"; } echo '</tr><tbody>'; } protected function printFooter(){ echo '</tbody></table>'; } protected function printUser($user){ echo '<tr>'; foreach ($this->cols as $col){ $data = htmlentities(utf8_decode($user->$col)); echo "<td>$data</td>"; } echo '</tr>'; } }
The code that has changed is:
foreach ($this->descriptions as $coldesc) { echo "<th>".htmlentities(utf8_decode($coldesc))."</th>"; }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Missing headers in the Excel Export? Find fix in here…’ is closed to new replies.