Example #1
0
    def setup_courses_worksheet(self,keys_and_labels=None):
        h = []
        h.append(('course_number','Course no.',3000))
        h.append(('offered_this_year','Offered this year',3000))
        h.append(('course_subject','Course subject',6000))
        h.append(('course_title','Course title',6000))
        h.append(('instructor','Instructor',3000))
        h.append(('other_instructors','Other Instructors',4000))
        h.append(('format','Course format',3000))
        h.append(('term','Term offered',3000))
        h.append(('open_to','Student cohort',3000))
        h.append(('day_and_time','Day and time',3000))
        h.append(('credit','Credit',3000))
        h.append(('compulsory','Compulsory',3000))
        h.append(('room','Room',3000))
        h.append(('start_date','Start date',4000))
        h.append(('course_outline','Course outline',18000))
        h.append(('course_objective','Course objective',9000))
        h.append(('textbooks','Textbooks',6000))
        h.append(('references','Reference materials',6000))
        h.append(('evaluation','Evaluation methods',6000))
        h.append(('prerequisites','Prerequisites',5000))
        h.append(('notes','Notes',5000))
        h.append(('ss_code','SS Code',3000))
        h.append(('year_offered','Year offered',3000))
        h.append(('sessions','Sessions',6000))
        
        self.set_field_codes(h)

        # Set column widths
        for key in self.field_codes.keys():
            pos = self.field_codes[key][1]
            width = self.field_codes[key][2]
            self.ws.col(pos).width = width
            
        # Line wrapping
        align = Alignment()
        align.wrap = Alignment.WRAP_AT_RIGHT
        align.vert = Alignment.VERT_TOP
        
        # A boldface font
        hfont = Font()
        hfont.bold = True
        hfont.colour_index = 141

        # Heading style
        self.hstyle = XFStyle()
        self.hstyle.num_format_str = '@'
        self.hstyle.alignment = align
        self.hstyle.font = hfont
        
        # Write in heading
        for key in self.field_codes.keys():
            mycol = self.field_codes[key][1]
            mydata = self.field_codes[key][0]
            self.ws.write(self.row,mycol,mydata,self.hstyle)
        self.row = self.row + 1
            
        # Code style
        self.cstyle = XFStyle()
        self.cstyle.num_format_str = '@'
        self.hstyle.alignment = align
        
        # Write in codes
        for key in self.field_codes.keys():
            mycol = self.field_codes[key][1]
            self.ws.write(self.row,mycol,key,self.cstyle)
        self.row = self.row + 1

        # Data cell style
        self.rstyle = XFStyle()
        self.rstyle.num_format_str = '@'
        self.rstyle.alignment = align
Example #2
0
    def setup_instructors_worksheet(self,keys_and_labels):
        h = []
        h.append(('uid','UID',2500))
        h.append(('status','Status',2500))
        h.append(('profession','Profession',2500))
        h.append(('family_name','Family name',2500))
        h.append(('given_name','Given name',2500))
        h.append(('proper_name','Proper name',2500))
        h.append(('birthdate','Birthdate (未公開)'.decode('utf8'),3000))
        h.append(('field','Field',3000))
        h.append(('affiliation','Affiliation',2500))
        h.append(('phone','Phone',2500))
        h.append(('office','Office',2500))
        h.append(('office_hours','Office hours',6000))
        h.append(('email','email (未公開)'.decode('utf8'),4000))
        h.append(('recommended_readings','Recommended readings',6000))
        h.append(('preparation_suggestions','Preparation suggestions for prospective applicants',6000))
        h.append(('website','Website',3000))
        h.append(('degrees','Degrees',6000))
        h.append(('research_interests','Research interests',6000))
        h.append(('memberships','Memberships',6000))
        h.append(('Jmemberships','所属学会\n(日本語サイトより)'.decode('utf8'),6000))
        h.append(('publications','Publications',12000))
        h.append(('Jpublications','主要著作\n(日本語サイトより)'.decode('utf8'),12000))
        h.append(('subjects','Subject areas',6000))
        h.append(('career_history','Career history',9000))
        h.append(('Jcareer_history','略歴\n(日本語サイトより)'.decode('utf8'),9000))
        h.append(('visitorships','Visitorships',6000))

        # Jesus, what a mess
        for key,label in keys_and_labels:
            width = 3000
            for x in h:
                if x[0] == key:
                    width = x[2]
            self.set_field_codes((key,label,width))
        
        # Set column widths
        for key in self.field_codes.keys():
            pos = self.field_codes[key][1]
            width = self.field_codes[key][2]
            self.ws.col(pos).width = width
            
        # Line wrapping
        align = Alignment()
        align.wrap = Alignment.WRAP_AT_RIGHT
        align.vert = Alignment.VERT_TOP
        
        # A boldface font
        hfont = Font()
        hfont.bold = True
        hfont.colour_index = 140
        hpat = Pattern()
        hpat.pattern_fore_colour = 140
        hpat.pattern = Pattern.SOLID_PATTERN

        # Heading style
        self.hstyle = XFStyle()
        self.hstyle.num_format_str = '@'
        self.hstyle.alignment = align
        self.hstyle.font = hfont
        self.hstyle.pattern = hpat
        
        # Write in heading
        for key in self.field_codes.keys():
            mycol = self.field_codes[key][1]
            mydata = self.field_codes[key][0]
            self.ws.write(self.row,mycol,mydata,self.hstyle)
        self.row = self.row + 1
            
        # Code style
        self.cstyle = XFStyle()
        self.cstyle.num_format_str = '@'
        self.hstyle.alignment = align
        
        # Write in codes
        for key in self.field_codes.keys():
            mycol = self.field_codes[key][1]
            self.ws.write(self.row,mycol,key,self.cstyle)
        self.row = self.row + 1

        # Data cell style
        self.rstyle = XFStyle()
        self.rstyle.num_format_str = '@'
        self.rstyle.alignment = align