You are here

function ViewsDataExportExporterExcelxlsx::get_headers in Views data export 7.4

Provide headers to the page when an export file is being downloaded.

Parameters

$filename: The name of the file being downloaded. e.g. export.xls.

Overrides ViewsDataExportExporter::get_headers

File

exporters/views_data_export_exporter_excel_xlsx.inc, line 177

Class

ViewsDataExportExporterExcelxlsx
This exporter creates an XLSX file readable by newer versions of Excel.

Code

function get_headers($filename) {
  $headers = parent::get_headers($filename);
  $headers['Content-Type'] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
  $headers['Content-Disposition'] = "attachment; filename={$filename}.xlsx";
  return $headers;
}