예제 #1
0
 def test_create_user_field_get(self):
     user_field_get = odf_create_user_field_get(u'你好 Zoé', value=42)
     expected = ('<text:user-field-get text:name="%s" '
                   'office:value-type="float" office:value="42">'
                   '42'
                 '</text:user-field-get>') % convert_unicode(u'你好 Zoé')
     self.assertEqual(user_field_get.serialize(), expected)
예제 #2
0
 def test_create_user_field_get(self):
     user_field_get = odf_create_user_field_get('你好 Zoé', value=42)
     expected = ('<text:user-field-get text:name="%s" '
                   'office:value-type="float" office:value="42">'
                   '42'
                 '</text:user-field-get>') % convert_unicode('你好 Zoé')
     self.assertEqual(user_field_get.serialize(), expected)
예제 #3
0
# 7- An user field
# ----------------

# An user field "pi5" with the value 3.14159
user_field_decl = odf_create_user_field_decl('pi5', value=3.14159)

# Insert
heading = odf_create_heading(1, text=u'An user field')
body.append(heading)

decl = body.get_user_field_decls()
decl.append(user_field_decl)

text = u'The value of pi5 is: '
value = body.get_user_field_value('pi5')
user_field_get = odf_create_user_field_get('pi5', value)
paragraph = odf_create_paragraph(text, style=u"Standard")
body.append(paragraph)
paragraph._insert_between(user_field_get, u"The", u"is: ")

# 8- Page number
# --------------

heading = odf_create_heading(1, text=u'Page number')
body.append(heading)

text1 = u'The current page is: '
text2 = u'The previous page is: '
text3 = u'The next page is: '
text4 = u'The total page number is: '
예제 #4
0
# 5- An user field
# ----------------

# An user field "pi5" with the value 3.14159
user_field_decl = odf_create_user_field_decl('pi5', value=3.14159)

# Insert
heading = odf_create_heading(1, text=u'An user field')
body.append(heading)

decl = body.get_user_field_decls()
decl.append(user_field_decl)

text = u'The value of pi5 is: '
value = body.get_user_field_value('pi5')
user_field_get = odf_create_user_field_get('pi5', value)
paragraph = odf_create_paragraph(text, style=u"Standard")
body.append(paragraph)
paragraph._insert_between(user_field_get, u"The", u"is: ")


# 6- Page number
# --------------

heading = odf_create_heading(1, text=u'Page number')
body.append(heading)

text1 = u'The current page is: '
text2 = u'The previous page is: '
text3 = u'The next page is: '
text4 = u'The total page number is: '