예제 #1
0
    def test_xlsx_to_reader(self):
        import xlsxwriter
        write_wb = xlsxwriter.Workbook()
        ws = write_wb.add_worksheet('Foo')
        ws.write(0, 0, 'bar')

        wb = xlsx_to_reader(write_wb)
        sh = wb.sheet_by_name('Foo')
        assert sh.cell_value(rowx=0, colx=0) == 'bar'
예제 #2
0
    def test_xlsx_to_reader(self):
        import xlsxwriter
        write_wb = xlsxwriter.Workbook()
        ws = write_wb.add_worksheet('Foo')
        ws.write(0, 0, 'bar')

        wb = xlsx_to_reader(write_wb)
        sh = wb.sheet_by_name('Foo')
        assert sh.cell_value(rowx=0, colx=0) == 'bar'
예제 #3
0
파일: __init__.py 프로젝트: level12/tribune
    def from_nested_iters(cls, data):
        """Builds an XlrdSheetData from nested iterables.

        param data: is nested iterables representing data for each cell.
                    For example, `[('A1', 'B1'), ('A2', 'B2')]` represents two rows and two columns
                    of data.
        """
        workbook = Workbook(BytesIO())
        sheet = workbook.add_worksheet('test')

        for row, row_data in enumerate(data):
            for column, cell_data in enumerate(row_data):
                sheet.write(row, column, cell_data)

        return XlrdSheetData(xlsx_to_reader(workbook).sheet_by_index(0))
예제 #4
0
    def from_nested_iters(cls, data):
        """Builds an XlrdSheetData from nested iterables.

        param data: is nested iterables representing data for each cell.
                    For example, `[('A1', 'B1'), ('A2', 'B2')]` represents two rows and two columns
                    of data.
        """
        workbook = Workbook(BytesIO())
        sheet = workbook.add_worksheet('test')

        for row, row_data in enumerate(data):
            for column, cell_data in enumerate(row_data):
                sheet.write(row, column, cell_data)

        return XlrdSheetData(xlsx_to_reader(workbook).sheet_by_index(0))
예제 #5
0
 def generate_report(self):
     wb = Workbook(BytesIO())
     ws = wb.add_worksheet(CarDealerSheet.sheet_name)
     CarDealerSheet(wb, worksheet=ws)
     book = xlsx_to_reader(wb)
     return book.sheet_by_name('Dealership Summary')
예제 #6
0
 def generate_report(self, reportcls=CarSheet):
     wb = Workbook(BytesIO())
     ws = wb.add_worksheet(reportcls.sheet_name)
     reportcls(wb, worksheet=ws)
     book = xlsx_to_reader(wb)
     return book.sheet_by_name('Car Info')
예제 #7
0
 def generate_report(self):
     wb = Workbook(BytesIO())
     ws = wb.add_worksheet(CarDealerSheet.sheet_name)
     CarDealerSheet(wb, worksheet=ws)
     book = xlsx_to_reader(wb)
     return book.sheet_by_name('Dealership Summary')
예제 #8
0
 def generate_report(self, reportcls=CarSheet):
     wb = Workbook(BytesIO())
     ws = wb.add_worksheet(reportcls.sheet_name)
     reportcls(wb, worksheet=ws)
     book = xlsx_to_reader(wb)
     return book.sheet_by_name('Car Info')