diff --git a/lib/Excel/Writer/XLSX.pm b/lib/Excel/Writer/XLSX.pm index 11fd11b7..f1829fed 100644 --- a/lib/Excel/Writer/XLSX.pm +++ b/lib/Excel/Writer/XLSX.pm @@ -6624,6 +6624,7 @@ The following list is taken from the MS XLSX extensions documentation on future _xlfn.ACOTH _xlfn.AGGREGATE _xlfn.ARABIC + _xlfn.ARRAYTOTEXT _xlfn.BASE _xlfn.BETA.DIST _xlfn.BETA.INV @@ -6643,6 +6644,7 @@ The following list is taken from the MS XLSX extensions documentation on future _xlfn.CHISQ.INV.RT _xlfn.CHISQ.TEST _xlfn.COMBINA + _xlfn.CONCAT _xlfn.CONFIDENCE.NORM _xlfn.CONFIDENCE.T _xlfn.COT @@ -6678,6 +6680,8 @@ The following list is taken from the MS XLSX extensions documentation on future _xlfn.GAUSS _xlfn.HYPGEOM.DIST _xlfn.IFNA + _xlfn.IFS + _xlfn.IMAGE _xlfn.IMCOSH _xlfn.IMCOT _xlfn.IMCSC @@ -6688,9 +6692,13 @@ The following list is taken from the MS XLSX extensions documentation on future _xlfn.IMTAN _xlfn.ISFORMULA ISO.CEILING + _xlfn.ISOMITTED _xlfn.ISOWEEKNUM + _xlfn.LET _xlfn.LOGNORM.DIST _xlfn.LOGNORM.INV + _xlfn.MAXIFS + _xlfn.MINIFS _xlfn.MODE.MULT _xlfn.MODE.SNGL _xlfn.MUNIT @@ -6728,13 +6736,18 @@ The following list is taken from the MS XLSX extensions documentation on future _xlfn.T.INV _xlfn.T.INV.2T _xlfn.T.TEST + _xlfn.TEXTAFTER + _xlfn.TEXTBEFORE + _xlfn.TEXTJOIN _xlfn.UNICHAR _xlfn.UNICODE + _xlfn.VALUETOTEXT _xlfn.VAR.P _xlfn.VAR.S _xlfn.WEBSERVICE _xlfn.WEIBULL.DIST WORKDAY.INTL + _xlfn.XMATCH _xlfn.XOR _xlfn.Z.TEST diff --git a/lib/Excel/Writer/XLSX/Worksheet.pm b/lib/Excel/Writer/XLSX/Worksheet.pm index 7dac6d50..b3f36049 100644 --- a/lib/Excel/Writer/XLSX/Worksheet.pm +++ b/lib/Excel/Writer/XLSX/Worksheet.pm @@ -2940,6 +2940,7 @@ sub _prepare_formula { $formula =~ s/\b(HYPGEOM.DIST\()/_xlfn.$1/g; $formula =~ s/\b(IFNA\()/_xlfn.$1/g; $formula =~ s/\b(IFS\()/_xlfn.$1/g; + $formula =~ s/\b(IMAGE\()/_xlfn.$1/g; $formula =~ s/\b(IMCOSH\()/_xlfn.$1/g; $formula =~ s/\b(IMCOT\()/_xlfn.$1/g; $formula =~ s/\b(IMCSCH\()/_xlfn.$1/g; @@ -3086,8 +3087,8 @@ sub write_formula { # Check that row and col are valid and store max and min values return -2 if $self->_check_dimensions( $row, $col ); - # Remove the = sign if it exists. - $formula =~ s/^=//; + # Expand out the formula. + $formula = $self->_prepare_formula($formula); # Write previous row if in in-line string optimization mode. if ( $self->{_optimization} == 1 && $row > $self->{_previous_row} ) { diff --git a/t/worksheet/sub_prepare_formula.t b/t/worksheet/sub_prepare_formula.t index 3c92726b..54bed9fc 100644 --- a/t/worksheet/sub_prepare_formula.t +++ b/t/worksheet/sub_prepare_formula.t @@ -9,7 +9,7 @@ use strict; use warnings; use Excel::Writer::XLSX::Worksheet; -use Test::More tests => 179; +use Test::More tests => 180; ############################################################################### @@ -98,6 +98,7 @@ my @testcases = ( ['F.INV()', '_xlfn.F.INV()'], ['GAMMA()', '_xlfn.GAMMA()'], ['GAUSS()', '_xlfn.GAUSS()'], + ['IMAGE()', '_xlfn.IMAGE()'], ['IMCOT()', '_xlfn.IMCOT()'], ['IMCSC()', '_xlfn.IMCSC()'], ['IMSEC()', '_xlfn.IMSEC()'],