feat: 년 판매현황 엑셀 최상단에 지역/범위·단위·출력일 제목 블록 추가
- export_excel_2003_xml 에 헤더 위 제목행(topRows) 옵션 추가(하위호환) - 년판매 export: '시도 구군 / 범위', '(단위 : 매/원)', '연도 판매현황 · 대행소', '출력일' 표기 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -76,8 +76,9 @@ if (! function_exists('export_excel_2003_xml')) {
|
||||
* @param string $sheetName 시트 이름(Excel 제한: 길이·일부 문자)
|
||||
* @param string[] $headers 컬럼 헤더
|
||||
* @param array $rows 데이터 행(각 행은 배열, 값은 문자열로 출력)
|
||||
* @param array $topRows 헤더 위에 추가할 제목/부제 행(각 행은 배열). 비우면 없음.
|
||||
*/
|
||||
function export_excel_2003_xml(string $filename, string $sheetName, array $headers, array $rows): void
|
||||
function export_excel_2003_xml(string $filename, string $sheetName, array $headers, array $rows, array $topRows = []): void
|
||||
{
|
||||
$filename = preg_replace('/\.[^.]+$/u', '', $filename) . '.xls';
|
||||
|
||||
@@ -97,6 +98,15 @@ if (! function_exists('export_excel_2003_xml')) {
|
||||
$parts[] = '<Worksheet ss:Name="' . $esc($safeSheet) . '">';
|
||||
$parts[] = '<Table>';
|
||||
|
||||
// 상단 제목/부제 행(있을 때만)
|
||||
foreach ($topRows as $topRow) {
|
||||
$parts[] = '<Row>';
|
||||
foreach (array_values((array) $topRow) as $cell) {
|
||||
$parts[] = '<Cell><Data ss:Type="String">' . $esc($cell) . '</Data></Cell>';
|
||||
}
|
||||
$parts[] = '</Row>';
|
||||
}
|
||||
|
||||
$parts[] = '<Row>';
|
||||
foreach ($headers as $h) {
|
||||
$parts[] = '<Cell><Data ss:Type="String">' . $esc($h) . '</Data></Cell>';
|
||||
|
||||
Reference in New Issue
Block a user