float converted to string in ods
Hello,
I just started using POD. I have created an *.ods template and
managed to get a result.ods from the renderer, which fills desired
fields.
Now the problem is that the fields are filled with something like '2014
and not the number 2014. According to your website this should happen,
so could you point me to why this is going wrong?
I have a dataDict = { 'year': 2014 } and in the ods: ="year".
Kind Regards,
Peter
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- Appy Edit question
- Assignee:
- No assignee Edit question
- Last query:
- 2014-03-05
- Last reply:
- 2014-06-23
davide moro (davide-moro) said : | #1 |
Hi Peter,
I experienced the same issue.
Have you found a workaround for this?
Best regards,
davide
Peter Veltman (p-veltman) said : | #2 |
Yes, I've created my own parser/generator.
## code ## (no further help)
import zipfile
import xml.dom.minidom
dataDict = {'$month'
outfile = "output.ods"
## Read template
tempFile = zipfile.
tempFileList = tempFile.infolist()
## Create outputFile
outFile = zipfile.
for tFile in tempFileList:
if (tFile.
stringFile = tempFile.
## Now search and replace content in template and write this to outFile
contentFile = tempFile.
doc = xml.dom.
cells = doc.getElements
#print "I have ", len(cells), "cells "
for cell in cells:
cellData = ''
for i in range(0,
## Find the cells that are strings, check if the text:p element data is equal to a dict.key
##print cell.attributes
for p in nodeList:
for ch in p.childNodes:
#print "after: ",cell.toxml()
## Then write to content.xml.
newContentFile = doc.toxml(
outFile.
print "Saved data to", outfile
davide moro (davide-moro) said : | #3 |
Thank you for sharing!
Instead for who needs a solution without having to write their own parser here it is a non techical workaround:
* add a hidden cell with ="myfloatvar" (for example E7)
* put a formula on the cell you want to display with =VALUE(E7) if you need a float or =INT(E7) for integers
Launchpad Janitor (janitor) said : | #4 |
This question was expired because it remained in the 'Open' state without activity for the last 15 days.
See the related bug.