feat(backup): add standalone in-portal .kmh converter to Excel, CSV, and SQL with zero storage retention

This commit is contained in:
Ray1111-aa
2026-10-30 10:29:04 +07:00
parent 721abb56c2
commit a32e996780
6 changed files with 1308 additions and 3 deletions
+3 -2
View File
@@ -16,7 +16,7 @@ class SimpleXlsxExporter
* @param array $alignments Optional per-column alignment: 'center' or 'left'
* @return string Raw zip content
*/
public static function create(string $title, array $metaLines, array $headers, array $rows, array $alignments = []): string
public static function create(string $title, array $metaLines, array $headers, array $rows, array $alignments = [], ?string $sheetName = null): string
{
$numCols = count($headers);
$lastColLetter = self::colLetter($numCols);
@@ -143,10 +143,11 @@ class SimpleXlsxExporter
</cellXfs>
</styleSheet>';
$cleanSheetName = htmlspecialchars(mb_substr($sheetName ?: 'Data', 0, 31), ENT_XML1);
$workbookXml = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<workbook xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
<sheets>
<sheet name="Data SIMPER" sheetId="1" r:id="rId1" />
<sheet name="' . $cleanSheetName . '" sheetId="1" r:id="rId1" />
</sheets>
</workbook>';