You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by ji...@apache.org on 2026/08/06 11:49:22 UTC
(openoffice) branch AOO42X updated (af89ef6112 -> 51733d5b8a)
This is an automated email from the ASF dual-hosted git repository.
jimjag pushed a change to branch AOO42X
in repository https://gitbox.apache.org/repos/asf/openoffice.git
from af89ef6112 Draw rectangle around menu button in toolbar for better visibility on e.g. Linux)
new a10e448eee When converting the .sxc table:formula XML attribute to ODF, use the "of" namespace instead of "ooow". Also add a unit test for saving and reloading formulas to .sxc files.
new 51733d5b8a Allowing exporting ODF < 1.2 formulas to Excel 2003 XML too.
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../source/xslt/export/spreadsheetml/formular.xsl | 12 ++++-
main/xmloff/source/transform/OOo2Oasis.cxx | 2 +-
.../fvt/uno/sc/formula/TestFormulaRoundTrip.java | 53 ++++++++++++++++------
3 files changed, 51 insertions(+), 16 deletions(-)
(openoffice) 02/02: Allowing exporting ODF < 1.2 formulas to Excel 2003 XML too.
Posted by ji...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
jimjag pushed a commit to branch AOO42X
in repository https://gitbox.apache.org/repos/asf/openoffice.git
commit 51733d5b8a515f1016f8319b03ad3947c008a473
Author: Damjan Jovanovic <da...@apache.org>
AuthorDate: Sat Nov 22 11:13:27 2025 +0200
Allowing exporting ODF < 1.2 formulas to Excel 2003 XML too.
Patch by: me
(cherry picked from commit 50f8b0f2cfecde16fe43969c61fd11a54f6ff30c)
---
main/filter/source/xslt/export/spreadsheetml/formular.xsl | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/main/filter/source/xslt/export/spreadsheetml/formular.xsl b/main/filter/source/xslt/export/spreadsheetml/formular.xsl
index 7243b27bde..8342a5b75c 100644
--- a/main/filter/source/xslt/export/spreadsheetml/formular.xsl
+++ b/main/filter/source/xslt/export/spreadsheetml/formular.xsl
@@ -87,7 +87,7 @@
<xsl:choose>
<!-- OASIS Open Document XML formular expressions -->
<xsl:when test="starts-with($expression,'of:')">
- <!-- giving out the '=', which will be removed with 'of:=' to enable recursive string parsing -->
+ <!-- ODF >= 1.2: giving out the '=', which will be removed with 'of:=' to enable recursive string parsing -->
<xsl:text>=</xsl:text>
<xsl:call-template name="function-parameter-mapping">
<xsl:with-param name="rowPos" select="$rowPos" />
@@ -96,6 +96,16 @@
<xsl:with-param name="expression" select="translate(substring($expression,5),';',',')"/>
</xsl:call-template>
</xsl:when>
+ <xsl:when test="starts-with($expression,'oooc:')">
+ <!-- ODF < 1.2: giving out the '=', which will be removed with 'oooc:=' to enable recursive string parsing -->
+ <xsl:text>=</xsl:text>
+ <xsl:call-template name="function-parameter-mapping">
+ <xsl:with-param name="rowPos" select="$rowPos" />
+ <xsl:with-param name="columnPos" select="$columnPos" />
+ <!-- 1) remove 'oooc:=' prefix and exchange ';' with ',' -->
+ <xsl:with-param name="expression" select="translate(substring($expression,7),';',',')"/>
+ </xsl:call-template>
+ </xsl:when>
<xsl:otherwise>
<xsl:value-of select="$expression" />
</xsl:otherwise>
(openoffice) 01/02: When converting the .sxc table:formula XML attribute to ODF, use the "of" namespace instead of "ooow". Also add a unit test for saving and reloading formulas to .sxc files.
Posted by ji...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
jimjag pushed a commit to branch AOO42X
in repository https://gitbox.apache.org/repos/asf/openoffice.git
commit a10e448eee6a08cf62d63da05d9da894588cfa72
Author: Damjan Jovanovic <da...@apache.org>
AuthorDate: Tue Nov 18 08:00:48 2025 +0200
When converting the .sxc table:formula XML attribute to ODF, use
the "of" namespace instead of "ooow". Also add a unit test for
saving and reloading formulas to .sxc files.
Patch by: me
Fixes: https://bz.apache.org/ooo/show_bug.cgi?id=128625
importing .sxc corrupts formulas
(cherry picked from commit 371410417827e07a8f8596550830c16c641bed7c)
---
main/xmloff/source/transform/OOo2Oasis.cxx | 2 +-
.../fvt/uno/sc/formula/TestFormulaRoundTrip.java | 53 ++++++++++++++++------
2 files changed, 40 insertions(+), 15 deletions(-)
diff --git a/main/xmloff/source/transform/OOo2Oasis.cxx b/main/xmloff/source/transform/OOo2Oasis.cxx
index 126535becb..90be61fb8f 100644
--- a/main/xmloff/source/transform/OOo2Oasis.cxx
+++ b/main/xmloff/source/transform/OOo2Oasis.cxx
@@ -887,7 +887,7 @@ static XMLTransformerActionInit aTableValueTypeActionTable[] =
XML_NAMESPACE_OFFICE, XML_STRING_VALUE ),
ENTRY0( TABLE, STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
ENTRY1( TABLE, FORMULA, XML_ATACTION_ADD_APP_NAMESPACE_PREFIX,
- XML_NAMESPACE_OOOW ),
+ XML_NAMESPACE_OF ),
ENTRY1Q( TABLE, VALIDATION_NAME, XML_ATACTION_RENAME,
XML_NAMESPACE_TABLE, XML_CONTENT_VALIDATION_NAME ),
ENTRY0( TABLE, TOKEN_INVALID, XML_ATACTION_EOT )
diff --git a/test/testuno/source/fvt/uno/sc/formula/TestFormulaRoundTrip.java b/test/testuno/source/fvt/uno/sc/formula/TestFormulaRoundTrip.java
index a1c2894732..8750a6ea72 100644
--- a/test/testuno/source/fvt/uno/sc/formula/TestFormulaRoundTrip.java
+++ b/test/testuno/source/fvt/uno/sc/formula/TestFormulaRoundTrip.java
@@ -68,34 +68,59 @@ public class TestFormulaRoundTrip {
unoApp.close();
}
- @Test
- public void testMSExcel2003XMLFormulaRoundTrip() throws Exception {
+ private XSpreadsheet generateTestDocument(XSpreadsheetDocument scDocument) throws Exception {
XSpreadsheet sheet = SCUtil.getCurrentSheet(scDocument);
SCUtil.setTextToCell(sheet, 0, 0, "Hello world");
SCUtil.setFormulaToCell(sheet, 0, 1, "=A1");
+ return sheet;
+ }
+
+ @Test
+ public void testMSExcel2003XMLFormulaRoundTrip() throws Exception {
+ XSpreadsheet sheet = generateTestDocument(scDocument);
String formulaValue = SCUtil.getTextFromCell(sheet, 0, 1);
assertEquals("Hello world", formulaValue);
+ String path = "output/sc/temp.xml";
+ saveFormatTo("MS Excel 2003 XML", Testspace.getUrl(path));
+ unoApp.closeDocument(scComponent);
- String storeUrl = Testspace.getUrl("output/sc/temp.xml");
- PropertyValue[] storeProps = new PropertyValue[2];
- storeProps[0] = new PropertyValue();
- storeProps[0].Name = "FilterName";
- storeProps[0].Value = "MS Excel 2003 XML";
- storeProps[1] = new PropertyValue();
- storeProps[1].Name = "Overwrite";
- storeProps[1].Value = new Boolean(true);
- XStorable scStorable =
- (XStorable) UnoRuntime.queryInterface(XStorable.class, scComponent);
- scStorable.storeAsURL(storeUrl, storeProps);
+ scDocument = (XSpreadsheetDocument) UnoRuntime.queryInterface(
+ XSpreadsheetDocument.class, unoApp.loadDocument(Testspace.getPath(path)));
+ sheet = SCUtil.getCurrentSheet(scDocument);
+ String formulaValue2 = SCUtil.getTextFromCell(sheet, 0, 1);
+ assertEquals("Hello world", formulaValue2);
+ String formula2 = SCUtil.getFormulaFromCell(sheet, 0, 1);
+ assertEquals("=A1", formula2);
+ }
+ @Test
+ public void testStarOfficeXMLFormulaRoundTrip() throws Exception {
+ XSpreadsheet sheet = generateTestDocument(scDocument);
+ String formulaValue = SCUtil.getTextFromCell(sheet, 0, 1);
+ assertEquals("Hello world", formulaValue);
+ String path = "output/sc/temp.sxc";
+ saveFormatTo("StarOffice XML (Calc)", Testspace.getUrl(path));
unoApp.closeDocument(scComponent);
scDocument = (XSpreadsheetDocument) UnoRuntime.queryInterface(
- XSpreadsheetDocument.class, unoApp.loadDocument(Testspace.getPath("output/sc/temp.xml")));
+ XSpreadsheetDocument.class, unoApp.loadDocument(Testspace.getPath(path)));
sheet = SCUtil.getCurrentSheet(scDocument);
String formulaValue2 = SCUtil.getTextFromCell(sheet, 0, 1);
assertEquals("Hello world", formulaValue2);
String formula2 = SCUtil.getFormulaFromCell(sheet, 0, 1);
assertEquals("=A1", formula2);
}
+
+ private void saveFormatTo(String filterName, String storeUrl) throws Exception {
+ PropertyValue[] storeProps = new PropertyValue[2];
+ storeProps[0] = new PropertyValue();
+ storeProps[0].Name = "FilterName";
+ storeProps[0].Value = filterName;
+ storeProps[1] = new PropertyValue();
+ storeProps[1].Name = "Overwrite";
+ storeProps[1].Value = new Boolean(true);
+ XStorable scStorable =
+ (XStorable) UnoRuntime.queryInterface(XStorable.class, scComponent);
+ scStorable.storeAsURL(storeUrl, storeProps);
+ }
}