Skip to content

Commit

Permalink
Variables example added
Browse files Browse the repository at this point in the history
  • Loading branch information
T0ha committed Nov 28, 2014
1 parent 7686c80 commit 3221366
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions examples/odt_05_variables.py
@@ -0,0 +1,21 @@
#!/usr/bin/env python
#coding:utf-8
# Purpose:
# Created: 28.11.14
# Copyright (C) 2014, Shvein Anton
# License: MIT license

from __future__ import unicode_literals, print_function
from ezodf import opendoc

if __name__ == '__main__':
doc = opendoc("../tests/data/variables.odt")
print("Simple variable 'simple1' = %s" % doc.body.variables['simple1'])

doc.body.variables['simple1'] = 'My cool variable'
print("Simple variable after modification 'simple1' = %s" % doc.body.variables['simple1'])

print("User field 'user_field1' = %s" % doc.body.userfields['simple1'])

doc.body.userfields['user_field1'] = 'My cool userfield'
print("User field after modification 'user_field1' = %s" % doc.body.userfields['simple1'])

0 comments on commit 3221366

Please sign in to comment.