This repository was archived by the owner on Jun 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathodfhandle.py
More file actions
55 lines (48 loc) · 1.33 KB
/
Copy pathodfhandle.py
File metadata and controls
55 lines (48 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
from ezodf import newdoc, opendoc, Sheet
RowNum = [0] #row number to replace row
def colNum(colNo):
return chr(colNo+65)
def replaceRow(sheet, row, index, visibility=None):
if visibility:
sheet.row_info(index).visibility=u"collapse"
cells=sheet.row(index)
if not row:
row=[]
for cell,val in zip(cells,row):
if type(val)==type("") and len(val)>0 and val[0]=="=":
cell.formula=val
else:
cell.set_value(val)
def insertRow(sheet,row,visibility=None):
replaceRow(sheet, row, RowNum[0], visibility)
RowNum[0] =RowNum[0]+ 1
def insertFormula(lenintents):
prec=RowNum[0]-5
recall=prec+1
F=prec+2
acc=prec+3
#sheet[prec,1].formula=0
def next_set(i,col):
return (col+str(13*i+9),col+str(13*i+10),col+str(13*i+11),col+str(13*i+12))
def formula(row,col,lenintent,name):
prec="=IFERROR("
rec="=IFERROR("
acc="=IFERROR("
F="=IFERROR("
row=row+3
if type(name)==type(""):name = "'"+name+"'."
else:name=""
tp=name+col+str(row)
if type(name)==type(""):tp+= " + " + name+chr(ord(col)+1)+str(row)
tp = "("+tp+")"
tn=name+col+str(row+1)
fn=name+col+str(row+2)
fp=name+col+str(row+3)
p = tp+"/( "+tp+" + "+fp+" )"
r = tp+"/("+tp+" + " + fp +" + "+fn+")"
prec+= p +"; 0 )"
rec+= r + "; 0)"
acc+=tp+"/("+tp+"+"+fn+"+"+fp+"); 0)"
#F+="2*"+tp+"/(2*"+tp+"+"+fp+"+"+fn+"), 0)"
F+="2*"+p+"*"+r+"/("+p+"+"+r+"); 0)"
return (prec,rec,acc,F)