Skip to content

Commit 9bf7318

Browse files
pfsj-xkkanyxmo
authored andcommitted
perf(office): 支持深层次的获取自定义的表格数据
1 parent 6317fc5 commit 9bf7318

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/office/src/Excel/PhpOffice.php

+2
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ public function export(string $filename, array|\Closure $closure, ?\Closure $cal
131131

132132
if (! empty($annotation['dictName'])) {
133133
$sheet->setCellValue($columnRow, $annotation['dictName'][$value]);
134+
} elseif (! empty($annotation['path'])&&! empty($annotation['dictData'])) {
135+
$sheet->setCellValue($columnRow, $annotation['dictData'][Arr::get($items, $annotation['path'])]);
134136
} elseif (! empty($annotation['path'])) {
135137
$sheet->setCellValue($columnRow, Arr::get($items, $annotation['path']));
136138
} elseif (! empty($annotation['dictData'])) {

src/office/src/Excel/XlsWriter.php

+2
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ public function export(string $filename, array|\Closure $closure, ?\Closure $cal
142142
if ($property['name'] == $name) {
143143
if (! empty($property['dictName'])) {
144144
$yield[] = $property['dictName'][$value];
145+
} elseif (! empty($property['path'])&&! empty($property['dictData'])) {
146+
$yield[] = $property['dictData'][Arr::get($item, $property['path'])];
145147
} elseif (! empty($property['dictData'])) {
146148
$yield[] = $property['dictData'][$value];
147149
} elseif (! empty($property['path'])) {

0 commit comments

Comments
 (0)