diff --git a/src/SimpleXLSXGen.php b/src/SimpleXLSXGen.php index 8809947..ce9a2a1 100644 --- a/src/SimpleXLSXGen.php +++ b/src/SimpleXLSXGen.php @@ -31,6 +31,7 @@ class SimpleXLSXGen { const F_ITALIC = 4; const F_UNDERLINE = 8; const F_STRIKE = 16; + const C_NORMAL = 0; const A_DEFAULT = 0; const A_LEFT = 1; const A_RIGHT = 2; @@ -44,6 +45,9 @@ class SimpleXLSXGen { $this->SI_KEYS = []; // & keys $this->F = [ self::F_NORMAL ]; // fonts $this->F_KEYS = [0]; // & keys + $this->C = [ self::C_NORMAL ]; // + $this->C_KEYS = [0]; // & keys + $this->XF = [ [self::N_NORMAL, self::F_NORMAL, self::A_DEFAULT] ]; // styles $this->XF_KEYS = ['N0F0A0' => 0 ]; // & keys @@ -295,14 +299,15 @@ class SimpleXLSXGen { $entries++; } elseif ( $cfilename === 'xl/styles.xml' ) { $FONTS = ['']; - foreach ( $this->F as $f ) { + foreach ( $this->F as $index => $f ) { $FONTS[] = '' . ( $this->defaultFontSize ? '' : '' ) - .( $f & self::F_BOLD ? '' : '') + .( $f & self::F_UNDERLINE ? '' : '') .( $f & self::F_ITALIC ? '' : '') .( $f & self::F_UNDERLINE ? '' : '') .( $f & self::F_STRIKE ? '' : '') - .( $f & self::F_HYPERLINK ? '' : '') + .( $f & self::F_HYPERLINK ? '' : '') + .( isset($this->C[$index]) ? '' : '') .''; } $FONTS[] = ''; @@ -448,7 +453,7 @@ class SimpleXLSXGen { } $ct = $cv = null; - $N = $F = $A = 0; + $N = $F = $A = $C = 0; if ( is_string($v) ) { @@ -469,6 +474,10 @@ class SimpleXLSXGen { if ( strpos( $v, '' ) !== false ) { $F += self::F_STRIKE; } + if ( strpos( $v, '' ) !== false ) { $A += self::A_LEFT; } @@ -582,6 +591,7 @@ class SimpleXLSXGen { $cf = count($this->F); $this->F_KEYS[$F] = $cf; $this->F[] = $F; + $this->C[] = $C; } $NFA = 'N' . $N . 'F' . $cf . 'A' . $A; if ( isset( $this->XF_KEYS[ $NFA ] ) ) { @@ -689,4 +699,4 @@ class SimpleXLSXGen { // but we use fast version return str_replace( ['&', '<', '>', "\x00","\x03","\x0B"], ['&', '<', '>', '', '', ''], $str ); } -} \ No newline at end of file +}