|
@@ -113,22 +113,30 @@ function export($columns, $rows, $filename = "jjrcw", $settings = [], $sheetname
|
|
|
for ($i = 0; $i < $colCount; $i++) {
|
|
|
$objPHPExcel->setCellValue(getExcelColumnByIndex($i) . $titleStartLine, $columns[$i]);
|
|
|
}
|
|
|
+ $formatString = [];
|
|
|
|
|
|
for ($i = 0; $i < $rowCount; $i++) {
|
|
|
for ($n = 0; $n < $colCount; $n++) {
|
|
|
if (is_numeric($rows[$i][$n]) && strlen($rows[$i][$n]) > 11) {
|
|
|
|
|
|
$objPHPExcel->setCellValueExplicit(getExcelColumnByIndex($n) . ($rowStartLine + $i), $rows[$i][$n], $datatype::TYPE_STRING);
|
|
|
+ $formatString[] = $n;
|
|
|
} else {
|
|
|
$objPHPExcel->setCellValue(getExcelColumnByIndex($n) . ($rowStartLine + $i), $rows[$i][$n]);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ $formatString = array_unique($formatString);
|
|
|
+
|
|
|
$objPHPExcel->getDefaultColumnDimension()->setWidth(16);
|
|
|
$objPHPExcel->getDefaultRowDimension()->setRowHeight(30);
|
|
|
|
|
|
$defaultSetting = getCommonExcelSetting($colCount, $rowCount);
|
|
|
- $mergeSettings = [];
|
|
|
+ foreach ($formatString as $fs) {
|
|
|
+ $columnName = getExcelColumnByIndex($fs);
|
|
|
+ $defaultSetting["format"][] = ["string", sprintf("%s%d:%s%d", $columnName, 2, $columnName, count($rows) + 1)];
|
|
|
+ }
|
|
|
+ $mergeSettings = [];
|
|
|
foreach ($defaultSetting as $key => $set) {
|
|
|
$mergeSettings[$key] = is_array($set) ? array_merge((array) $set, (array) $settings[$key]) : ($settings[$key] ?: $set);
|
|
|
unset($settings[$key]);
|