diff --git a/pyexcel_ods/__init__.py b/pyexcel_ods/__init__.py index 22faad6..79800d2 100644 --- a/pyexcel_ods/__init__.py +++ b/pyexcel_ods/__init__.py @@ -243,7 +243,8 @@ def write_cell(self, row, x): converter = ODS_VALUE_CONVERTERS.get(x_odf_type, None) if converter: x = converter(x) - tc.setAttrNS(OFFICENS, x_odf_value_token, x) + if x_odf_type != 'string': + tc.setAttrNS(OFFICENS, x_odf_value_token, x) tc.addElement(P(text=x)) row.addElement(tc) @@ -302,4 +303,4 @@ def get_data(afile, file_type=None, **keywords): return read_data(afile, file_type=file_type, **keywords) -__VERSION__ = "0.0.7" +__VERSION__ = "0.0.9" diff --git a/tests/test_bug_fixes.py b/tests/test_bug_fixes.py index 1ae7357..a1e3949 100644 --- a/tests/test_bug_fixes.py +++ b/tests/test_bug_fixes.py @@ -1,8 +1,17 @@ +#!/usr/bin/python +# -*- encoding: utf-8 -*- import os -from pyexcel_ods import get_data +from pyexcel_ods import get_data, save_data def test_bug_fix_for_issue_1(): data = get_data(os.path.join("tests", "fixtures", "repeated.ods")) assert data['Sheet1'] == [['repeated', 'repeated', 'repeated', 'repeated']] +def test_bug_fix_for_issue_2(): + data = {} + data.update({"Sheet 1": [[1, 2, 3], [4, 5, 6]]}) + data.update({"Sheet 2": [[u"row 1", u"Héllô!", u"HolÁ!"]]}) + save_data("your_file.ods", data) + new_data = get_data("your_file.ods") + assert new_data["Sheet 2"] == [[u'row 1', u'H\xe9ll\xf4!', u'Hol\xc1!']] \ No newline at end of file