diff options
author | László Németh <nemeth@numbertext.org> | 2020-08-11 19:32:52 +0200 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2020-08-12 09:40:46 +0200 |
commit | d42776e01b87f12fddbcf78101bca1e10a6e4f97 (patch) | |
tree | 33e276b4888864e3fc2f24aa5d7a3d30b139ab9c /sw/source/filter/ww8/docxattributeoutput.cxx | |
parent | 53e745b4d2450a80485273f96abe4f8e6479972b (diff) |
tdf#118682 DOCX: export formula fields
Convert also cell references by removing
parenthesization:
=<A1>+<B1> -> =A1*B1
=SUM(<A1:ZZ99> -> =SUM(A1:ZZ99)
See tdf#133647 for fixing import of cell references.
Change-Id: I5082198aaf8230989f99984f8129b54867b77859
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100546
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sw/source/filter/ww8/docxattributeoutput.cxx')
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 4d59477f9d68..7c15faf5e424 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -144,6 +144,7 @@ #include <stdarg.h> #include <toolkit/helper/vclunohelper.hxx> +#include <unicode/regex.h> using ::editeng::SvxBorderLine; @@ -2145,6 +2146,14 @@ void DocxAttributeOutput::CmdField_Impl( const SwTextNode* pNode, sal_Int32 nPos sToken = sToken.replaceAll("NNNN", "dddd"); sToken = sToken.replaceAll("NN", "ddd"); } + else if ( rInfos.eType == ww::eEquals ) + { + UErrorCode nErr(U_ZERO_ERROR); + icu::UnicodeString sInput(sToken.getStr()); + // remove < and > around cell references, e.g. <A1> to A1, <A1:B2> to A1:B2 + icu::RegexMatcher xMatch("<([A-Z]{1,3}[0-9]+(:[A-Z]{1,3}[0-9]+)?)>", sInput, 0, nErr); + sToken = xMatch.replaceAll(icu::UnicodeString("$1"), nErr).getTerminatedBuffer(); + } // Write the Field command DoWriteCmd( sToken ); |