from time import * from poi import Workbook #style = XFStyle() wb = Workbook() ws0 = wb.sheets.add('0') colcount = 200 + 1 rowcount = 6000 + 1 t0 = time() print "\nstart: %s" % ctime(t0) print "Filling..." for col in xrange(colcount): print "[%d]" % col, sys.stdout.flush() for row in xrange(rowcount): #ws0.write(row, col, "BIG(%d, %d)" % (row, col)) ws0.cells(row, col).Value = "BIG" t1 = time() - t0 print "\nsince starting elapsed %.2f s" % (t1) print "Storing..." wb.save('big-16Mb.xls') t2 = time() - t0 print "since starting elapsed %.2f s" % (t2)
font0.Fontname = 'Times New Roman' font0.StruckOut = True font0.Bold = True style0 = Format() style0.Font = font0 wb = Workbook() ws0 = wb.sheets.add('0') ws0.cells(1, 1).Value = 'Test' ws0.cells(1, 1).Format = style0 for i in range(0, 0x53): borders = Borders() borders.Left = i borders.Right = i borders.Top = i borders.Bottom = i ws0.cells(i, 2).Format.Borders = borders ws0.cells(i, 2).Format.Font = font0 ws0.cells(i, 3).Value = hex(i) ws0.cells(i, 3).Format = ws0.cells(i, 2).Format #ws0.write(i, 2, '', style) #ws0.write(i, 3, hex(i), style0) #ws0.write_merge(5, 8, 6, 10, "") wb.save('blanks.xls')
font0.Fontname = 'Times New Roman' font0.StruckOut = True font0.Bold = True style0 = Format() style0.Font = font0 wb = Workbook() ws0 = wb.sheets.add('0') ws0.cells(1, 1).Value='Test' ws0.cells(1, 1).Format=style0 for i in range(0, 0x53): borders = Borders() borders.Left = i borders.Right = i borders.Top = i borders.Bottom = i ws0.cells(i,2).Format.Borders=borders ws0.cells(i,2).Format.Font=font0 ws0.cells(i,3).Value=hex(i) ws0.cells(i,3).Format=ws0.cells(i,2).Format #ws0.write(i, 2, '', style) #ws0.write(i, 3, hex(i), style0) #ws0.write_merge(5, 8, 6, 10, "") wb.save('blanks.xls')
#style = XFStyle() wb = Workbook() ws0 = wb.sheets.add('0') colcount = 200 + 1 rowcount = 6000 + 1 t0 = time() print "\nstart: %s" % ctime(t0) print "Filling..." for col in xrange(colcount): print "[%d]" % col, sys.stdout.flush() for row in xrange(rowcount): #ws0.write(row, col, "BIG(%d, %d)" % (row, col)) ws0.cells(row,col).Value = "BIG" t1 = time() - t0 print "\nsince starting elapsed %.2f s" % (t1) print "Storing..." wb.save('big-16Mb.xls') t2 = time() - t0 print "since starting elapsed %.2f s" % (t2)
style3.ForegroundColor = 0x24 style3.Borders = brd3 style3.Rotation = -90 style3.JustifyLast = True style3.WrapText = True #price_style = XFStyle() #price_style.font = fnt4 #price_style.alignment = al2 #price_style.borders = brd3 #price_style.num_format_str = '_(#,##0.00_) "money"' # #ware_style = XFStyle() #ware_style.font = fnt4 #ware_style.alignment = al3 #ware_style.borders = brd3 ws0.cells(3, 3).Value = "Hallo" ws0.cells(3, 3).Format = style1 ws0.cells(4, 10).Value = "Hallo" ws0.cells(4, 10).Format = style2 ws0.cells(14, 16).Value = "Hallo" ws0.cells(14, 16).Format = style3 #ws0.merge(3, 3, 1, 5, style1) #ws0.merge(4, 10, 1, 6, style2) #ws0.merge(14, 16, 1, 7, style3) #ws0.col(1).width = 0x0d00 wb.save('merged1.xls')
wb.save('test.xls') wb=Workbook('test.xls') for ws in wb.sheets: dump_sheet(ws,wb.sheets[ws]) except int, e: print e exit(0) ''' #wb=Workbook('/home/user/workspace/Queck/mso/poi-3.8/test-data/spreadsheet/StringContinueRecords.xls') wb=Workbook('test.xls') print wb.date1904 for ws in wb.sheets: dump_sheet(ws,wb.sheets[ws]) wb.save('test2.xls') wb=Workbook('test2.xls') dump_supbooks(wb) #for ws in wb.sheets: # dump_sheet(ws,wb.sheets[ws]) exit(0) wb=Workbook('/home/user/workspace/Queck/mso/poi-3.8/test-data/spreadsheet/DateFormats.xls') for ws in wb._workbook.sheets: dump_sheet(ws)
#!/usr/bin/env python # tries stress SST, SAT and MSAT from time import * from poi import Workbook #style = XFStyle() wb = Workbook() ws0 = wb.sheets.add('0') colcount = 200 + 1 rowcount = 6000 + 1 t0 = time() for col in xrange(colcount): for row in xrange(rowcount): ws0.cells(row, col).Value="BIG(%d, %d)" % (row, col) t1 = time() - t0 print "\nsince starting elapsed %.2f s" % (t1) print "Storing..." wb.save('big-35Mb.xls') t2 = time() - t0 print "since starting elapsed %.2f s" % (t2)
style3.Borders = brd3 style3.Rotation=-90 style3.JustifyLast=True style3.WrapText=True #price_style = XFStyle() #price_style.font = fnt4 #price_style.alignment = al2 #price_style.borders = brd3 #price_style.num_format_str = '_(#,##0.00_) "money"' # #ware_style = XFStyle() #ware_style.font = fnt4 #ware_style.alignment = al3 #ware_style.borders = brd3 ws0.cells(3,3).Value="Hallo" ws0.cells(3,3).Format=style1 ws0.cells(4,10).Value="Hallo" ws0.cells(4,10).Format=style2 ws0.cells(14,16).Value="Hallo" ws0.cells(14,16).Format=style3 #ws0.merge(3, 3, 1, 5, style1) #ws0.merge(4, 10, 1, 6, style2) #ws0.merge(14, 16, 1, 7, style3) #ws0.col(1).width = 0x0d00 wb.save('merged1.xls')
ws.cells(2, 1).Formula = "-(134.8780789+1)" ws.cells(3, 1).Formula = "-(134.8780789e-10+1)" ws.cells(4, 1).Formula = "-1/(1+1)+9344" ws.cells(0, 2).Formula = "A1*$B1" ws.cells(1, 2).Formula = "A2*B$2" ws.cells(2, 2).Formula = "A3*$B$3" ws.cells(3, 2).Formula = "A4*B4*sin(pi()/4)" ws.cells(4, 2).Formula = "A5%*B5*pi()/1000" ############## ## NOTE: parameters are separated by semicolon!!! ############## ws.cells(5, 2).Formula = "C1+C2+C3+C4+C5/(C1+C2+C3+C4/(C1+C2+C3+C4/(C1+C2+C3+C4)+C5)+C5)-20.3e-2" ws.cells(5, 3).Formula = "C1^2" ws.cells(6, 2).Formula = "SUM(C1;C2;;;;;C3;;;C4)" # ws.cells(6, 3).Formula="SUM($A$1:$C$5)" ws.cells(7, 0).Formula = '"lkjljllkllkl"' ws.cells(7, 1).Formula = '"yuyiyiyiyi"' ws.cells(7, 2).Formula = "A8 & B8 & A8" # ws.cells(8, 2).Formula='now()' ws.cells(10, 2).Formula = "TRUE" ws.cells(11, 2).Formula = "FALSE" # ws.cells(12, 3).Formula='IF(A1>A2;3;"hkjhjkhk")' w.save("formulas.xls")
ws.cells(3, 1).Formula = "-(134.8780789e-10+1)" ws.cells(4, 1).Formula = "-1/(1+1)+9344" ws.cells(0, 2).Formula = "A1*$B1" ws.cells(1, 2).Formula = "A2*B$2" ws.cells(2, 2).Formula = "A3*$B$3" ws.cells(3, 2).Formula = "A4*B4*sin(pi()/4)" ws.cells(4, 2).Formula = "A5%*B5*pi()/1000" ############## ## NOTE: parameters are separated by semicolon!!! ############## ws.cells( 5, 2 ).Formula = "C1+C2+C3+C4+C5/(C1+C2+C3+C4/(C1+C2+C3+C4/(C1+C2+C3+C4)+C5)+C5)-20.3e-2" ws.cells(5, 3).Formula = "C1^2" ws.cells(6, 2).Formula = "SUM(C1;C2;;;;;C3;;;C4)" #ws.cells(6, 3).Formula="SUM($A$1:$C$5)" ws.cells(7, 0).Formula = '"lkjljllkllkl"' ws.cells(7, 1).Formula = '"yuyiyiyiyi"' ws.cells(7, 2).Formula = 'A8 & B8 & A8' #ws.cells(8, 2).Formula='now()' ws.cells(10, 2).Formula = 'TRUE' ws.cells(11, 2).Formula = 'FALSE' #ws.cells(12, 3).Formula='IF(A1>A2;3;"hkjhjkhk")' w.save('formulas.xls')