Esempio n. 1
0
File: sheets.py Progetto: tsk/vhd_tb
    def get_table(self, tables, pdic, tb_name):
        doc = load_workbook(self.file_name)
        dst_dir = os.path.dirname(os.path.abspath(self.file_name))
        for table in tables:
            sheet = doc.get_sheet_by_name(table)
            ports = tables[table]
            vector_mult = get_vector_conf(ports, pdic)[0]
            file_name = "%s/%s_%s_%s.tbl" % (dst_dir, tb_name, "xlsx", table)
            f = open(file_name, "w")
            for row in range(1, sheet.get_highest_row()):
                data = 0
                for col in range(sheet.get_highest_column()):
                    data += sheet.cell(row=row, column=col).value
                f.write(` data ` + "\n")

            f.close()
Esempio n. 2
0
File: sheets.py Progetto: tsk/vhd_tb
    def get_table(self, tables, pdic, tb_name):
        doc = load_workbook(self.file_name)
        dst_dir = os.path.dirname(os.path.abspath(self.file_name))
        for table in tables:
            sheet = doc.get_sheet_by_name(table)
            ports = tables[table]
            vector_mult = get_vector_conf(ports, pdic)[0]
            file_name = '%s/%s_%s_%s.tbl' % (dst_dir, tb_name, 'xlsx', table)
            f = open(file_name, 'w')
            for row in range(1, sheet.get_highest_row()):
                data = 0
                for col in range(sheet.get_highest_column()):
                    data += sheet.cell(row=row, column=col).value
                f.write( ` data ` + '\n')

            f.close()
Esempio n. 3
0
File: sheets.py Progetto: tsk/vhd_tb
    def get_table(self, tables, pdic, tb_name):
        doc = xlrd.open_workbook(self.file_name, formatting_info=True)
        dst_dir = os.path.dirname(os.path.abspath(self.file_name))
        for table in tables:
            sheet = doc.sheet_by_name(table)
            ports = tables[table]
            vector_mult = get_vector_conf(ports, pdic)[0]
            file_name = "%s/%s_%s_%s.tbl" % (dst_dir, tb_name, "xls", table)
            f = open(file_name, "w")
            for row in range(1, sheet.nrows):
                data = 0
                for col in range(sheet.ncols):
                    intr = sheet.cell(row, col).value
                    data += int(intr) * vector_mult[col]
                f.write(` data ` + "\n")

            f.close()
Esempio n. 4
0
File: sheets.py Progetto: tsk/vhd_tb
    def get_table(self, tables, pdic, tb_name):
        doc = xlrd.open_workbook(self.file_name, formatting_info=True)
        dst_dir = os.path.dirname(os.path.abspath(self.file_name))
        for table in tables:
            sheet = doc.sheet_by_name(table)
            ports = tables[table]
            vector_mult = get_vector_conf(ports, pdic)[0]
            file_name = '%s/%s_%s_%s.tbl' % (dst_dir, tb_name, 'xls', table)
            f = open(file_name, 'w')
            for row in range(1, sheet.nrows):
                data = 0
                for col in range(sheet.ncols):
                    intr = sheet.cell(row, col).value
                    data += int(intr) * vector_mult[col]
                f.write( ` data ` + '\n')

            f.close()
Esempio n. 5
0
File: sheets.py Progetto: tsk/vhd_tb
    def get_table(self, tables, pdic, tb_name):
        doc = ooolib.Calc(opendoc=self.file_name)
        dst_dir = os.path.dirname(os.path.abspath(self.file_name))
        sheets = {}
        for sheet in doc.sheets:
            sheets[sheet.get_name()] = sheet
        for table in tables:
            sheet = sheets[table]
            ports = tables[table]
            vector_mult = get_vector_conf(ports, pdic)[0]
            file_name = "%s/%s_%s_%s.tbl" % (dst_dir, tb_name, "ods", table)
            f = open(file_name, "w")
            (cols, rows) = sheet.get_sheet_dimensions()
            for row in range(2, rows + 1):
                data = 0
                for col in range(1, cols + 1):
                    intr = sheet.get_sheet_value(col, row)["value"]
                    data += int(intr[1]) * vector_mult[col - 1]
                f.write(` data ` + "\n")

            f.close()
Esempio n. 6
0
File: sheets.py Progetto: tsk/vhd_tb
    def get_table(self, tables, pdic, tb_name):
        doc = ooolib.Calc(opendoc=self.file_name)
        dst_dir = os.path.dirname(os.path.abspath(self.file_name))
        sheets = {}
        for sheet in doc.sheets:
            sheets[sheet.get_name()] = sheet
        for table in tables:
            sheet = sheets[table]
            ports = tables[table]
            vector_mult = get_vector_conf(ports, pdic)[0]
            file_name = '%s/%s_%s_%s.tbl' % (dst_dir, tb_name, 'ods', table)
            f = open(file_name, 'w')
            (cols, rows) = sheet.get_sheet_dimensions()
            for row in range(2, rows + 1):
                data = 0
                for col in range(1, cols + 1):
                    intr = sheet.get_sheet_value(col, row)['value']
                    data += int(intr[1]) * vector_mult[col - 1]
                f.write( ` data ` + "\n")

            f.close()