Exemplo n.º 1
0
 def __init__(self):
     self.book = [
         "AnneClass.xls",
     ]
     self.sheet = ["Grade7-1st", "Grade7-2st", "Grade7-3st"]
     self.field_name = [
         "Number", "Name", "Math", "English", "Chinese", "History",
         "Geography", "Civic", "Biology", "Total_score", "Ranking"
     ]
     self.name = []
     self.number = []
     self.math = []
     self.english = []
     self.chinese = []
     self.history = []
     self.geography = []
     self.civic = []
     self.biology = []
     self.total_score = []
     self.ranking = []
     self.totaldatalist = [
         self.number, self.name, self.math, self.english, self.chinese,
         self.history, self.geography, self.civic, self.biology,
         self.total_score, self.ranking
     ]
     if not os.path.isfile(self.book[0]):
         ExcelRw.create_tample_file(self.book[0], self.sheet)
         for sheetname in self.sheet:
             for i, field in enumerate(self.field_name):
                 ExcelRw.write(self.book[0], sheetname, 0, i, field)
     self.init_table_for_exist_excel(self.book[0], self.sheet[0])
Exemplo n.º 2
0
 def test_create_tample_file(self):
     sfilename = 'xxx.xls'
     slist = ['1', '2', '3']
     field_name = [
         "Number", "Name", "Math", "English", "Chinese", "History",
         "Geography", "Civic", "Biology", "Total_score", "Ranking"
     ]
     ExcelRw.create_tample_file(sfilename, slist)
     for sheetname in slist:
         for i, field in enumerate(field_name):
             ExcelRw.write(sfilename, sheetname, 0, i, field)
Exemplo n.º 3
0
 def test_write(self):
     ExcelRw.write(self.filename, self.sheetname, 4, 4, "See")