@@ -68,30 +68,39 @@ def write_cells(
68
68
for _ in range (cell .col - col_count [cell .row ]):
69
69
rows [cell .row ].addElement (TableCell ())
70
70
col_count [cell .row ] += 1
71
- class_to_cell_type = {
72
- str : "string" ,
73
- int : "float" ,
74
- float : "float" ,
75
- bool : "boolean" ,
76
- }
77
71
val , fmt = self ._value_with_fmt (cell .val )
78
- # print("type", type(val), "value", val)
79
- value = val
72
+ print ("type" , type (val ), "value" , val )
73
+ pvalue = value = val
80
74
if isinstance (val , bool ):
81
75
value = str (val ).lower ()
82
- # if isinstance(val, datetime.date):
83
- # tc = TableCell(valuetype="date",
84
- if isinstance (val , datetime .date ):
76
+ pvalue = str (val ).upper ()
77
+ if isinstance (val , datetime .datetime ):
78
+ print ('datetime' , val .strftime ("%Y-%m-%d" ), val .strftime ("%x" ))
79
+ if val .time ():
80
+ value = val .isoformat ()
81
+ pvalue = val .strftime ("%c" )
82
+ else :
83
+ value = val .strftime ("%Y-%m-%d" )
84
+ pvalue = val .strftime ("%x" )
85
+ tc = TableCell (valuetype = "date" , datevalue = value )
86
+ elif isinstance (val , datetime .date ):
85
87
print ('date' , val .strftime ("%Y-%m-%d" ), val .strftime ("%x" ))
86
88
value = val .strftime ("%Y-%m-%d" )
89
+ pvalue = val .strftime ("%x" )
90
+ # value = val.isoformat()
91
+ # pvalue = val.strftime("%c")
87
92
tc = TableCell (valuetype = "date" , datevalue = value )
88
93
else :
94
+ class_to_cell_type = {
95
+ str : "string" ,
96
+ int : "float" ,
97
+ float : "float" ,
98
+ bool : "boolean" ,
99
+ }
89
100
tc = TableCell (valuetype = class_to_cell_type [type (val )], value = value )
90
101
rows [cell .row ].addElement (tc )
91
102
col_count [cell .row ] += 1
92
- if isinstance (val , bool ):
93
- value = str (val ).upper ()
94
- p = P (text = value )
103
+ p = P (text = pvalue )
95
104
tc .addElement (p )
96
105
"""
97
106
stylekey = json.dumps(cell.style)
0 commit comments