Hi
How do you achive this when using PhpSpreadsheet?
thanksAdd a title to the export document and use custom export if export to Excel (not PhpSpreadsheet)function Page_Exporting() {
if ($this->Export == “excel”) {
$this->ExportDoc->Text = “
My Title
”; // Add a title
return FALSE; // Return FALSE to skip default export and use Row_Export event
}
return TRUE; // Return TRUE to use default export and skip Row_Export event
}
PhpSpreadsheet extension does not export by reading HTML, so you cannot use $this->ExportDoc->Text to add additional data.
You may try to override the ExportExcel5 class and implement the exportTableHeader() method, something like: (Note: This is to explain the idea only, not code for copy and paste, you must modify it yourself as needed.)(v2019)
class MyExportExcel5 extends ExportExcel5 {
// Table header
public function exportTableHeader() { // override
$this->setCellValueByColumnAndRow(0, $this->RowCnt, "My Title"); // set value at the first cell of first row
$this->RowCnt++; // increase the row count
}
}
$EXPORT['excel'] = 'MyExportExcel5'; // Replace the default ExportExcel class
You can put the your under server side Global Code.
I want all current filters in plain English and not SQL statement on my excel export and other exports as well. If a user selects a search field, print the filed out on the title of all exports. If not ,print out string ‘No filters’, so far only works on printer friendly and PDF in my projects . Nothing on excel spread sheet, I only get an empty row.
I would love to get filter fields to the spreadsheet export just like this worked for PDF and printer friendly, see https://discourse.hkvstore.com/t/summary-report-current-filter-to-string-and-not-sql-queries/4054/1