1
0
mirror of https://github.com/shuchkin/simplexlsxgen.git synced 2023-08-10 21:12:59 +03:00
This commit is contained in:
Sergey Shuchkin 2022-04-30 14:04:13 +06:00
parent 402c6b9417
commit bcd3586731
2 changed files with 6 additions and 2 deletions

View File

@ -481,8 +481,9 @@ class SimpleXLSXGen {
$COL = []; $COL = [];
foreach( $this->sheets[$idx]['rows'] as $r ) { foreach( $this->sheets[$idx]['rows'] as $r ) {
$CUR_ROW++; $CUR_ROW++;
$row = '<row r="'.$CUR_ROW.'">'; $row = '';
$CUR_COL = 0; $CUR_COL = 0;
$RH = 0; // row height
foreach( $r as $v ) { foreach( $r as $v ) {
$CUR_COL++; $CUR_COL++;
if ( !isset($COL[ $CUR_COL ])) { if ( !isset($COL[ $CUR_COL ])) {
@ -528,6 +529,9 @@ class SimpleXLSXGen {
$FL += self::FL_COLOR; $FL += self::FL_COLOR;
$B = strlen($m2[1]) === 8 ? $m2[1] : ('FF' . ltrim($m2[1],'#')); $B = strlen($m2[1]) === 8 ? $m2[1] : ('FF' . ltrim($m2[1],'#'));
} }
if ( preg_match('/ height="([^"]+)"/', $m[1], $m2) ) {
$RH = $m2[1];
}
} }
if ( strpos( $v, '<left>' ) !== false ) { if ( strpos( $v, '<left>' ) !== false ) {
$A += self::A_LEFT; $A += self::A_LEFT;
@ -660,7 +664,7 @@ class SimpleXLSXGen {
$row .= '<c r="' . $cname . '"' . ($ct ? ' t="' . $ct . '"' : '') . ($cs ? ' s="' . $cs . '"' : '') . '>' $row .= '<c r="' . $cname . '"' . ($ct ? ' t="' . $ct . '"' : '') . ($cs ? ' s="' . $cs . '"' : '') . '>'
. ($ct === 'inlineStr' ? '<is><t>' . $cv . '</t></is>' : '<v>' . $cv . '</v>') . "</c>\r\n"; . ($ct === 'inlineStr' ? '<is><t>' . $cv . '</t></is>' : '<v>' . $cv . '</v>') . "</c>\r\n";
} }
$ROWS[] = $row . "</row>\r\n"; $ROWS[] = '<row r="'.$CUR_ROW.'"'.($RH ? ' customHeight="1" ht="'.$RH.'"' : '').'>'.$row . "</row>";
} }
foreach ( $COL as $k => $max ) { foreach ( $COL as $k => $max ) {
$COLS[] = '<col min="'.$k.'" max="'.$k.'" width="'.min( $max+1, 60).'" />'; $COLS[] = '<col min="'.$k.'" max="'.$k.'" width="'.min( $max+1, 60).'" />';

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 30 KiB