Beispiel #1
0
 def cell(self, rdrowx, rdcolx, wtrowx, wtcolx):
     cell = self.rdsheet.cell(rdrowx, rdcolx)
     if cell.ctype == xlrd.XL_CELL_EMPTY:
         return
     if cell.ctype == xlrd.XL_CELL_ERROR:
         logger.error("Cell %s of sheet %r contains a bad value: %s" % (
             xlrd.cellname(rdrowx, rdcolx),
             quoted_sheet_name(self.rdsheet.name),
             cell_display(cell, self.rdbook.datemode),
         ))
         return
     BaseWriter.cell(self, rdrowx, rdcolx, wtrowx, wtcolx)
Beispiel #2
0
 def cell(self,rdrowx,rdcolx,wtrowx,wtcolx):
     cell = self.rdsheet.cell(rdrowx,rdcolx)
     if cell.ctype == xlrd.XL_CELL_EMPTY:
         return
     if cell.ctype == xlrd.XL_CELL_ERROR:
         logger.error("Cell %s of sheet %r contains a bad value: %s" % (
                     xlrd.cellname(rdrowx, rdcolx),
                     quoted_sheet_name(self.rdsheet.name),
                     cell_display(cell,self.rdbook.datemode),
                     ))
         return
     BaseWriter.cell(self,rdrowx,rdcolx,wtrowx,wtcolx)
Beispiel #3
0
 def flush(self):
     if self.rdsheet is not None:
         rsn = None
         for ra in self.ranges:
             if rsn is None:
                 rsn = ra.rsn
             elif ra.rsn!=rsn:
                 self.rdsheet = self.rdbook.sheet_by_name(ra.rsn)
                 self.next.set_rdsheet(self.rdsheet)
                 rsn = ra.rsn
             for r in range(ra.r):
                 for c in range(ra.c):
                     wtcolx=ra.wc+c
                     if wtcolx<=self.max_nonjunk:
                         self.next.cell(ra.rr+r,ra.rc+c,ra.wr+r,ra.wc+c)
         if self.max!=self.max_nonjunk:
             logger.debug("Number of columns trimmed from %d to %d for sheet %r",
                          self.max+1,
                          self.max_nonjunk+1,
                          quoted_sheet_name(self.wtsheet_name))
     self.start(chain=False)
Beispiel #4
0
 def flush(self):
     if self.rdsheet is not None:
         rsn = None
         for ra in self.ranges:
             if rsn is None:
                 rsn = ra.rsn
             elif ra.rsn != rsn:
                 self.rdsheet = self.rdbook.sheet_by_name(ra.rsn)
                 self.next.set_rdsheet(self.rdsheet)
                 rsn = ra.rsn
             for r in range(ra.r):
                 for c in range(ra.c):
                     wtcolx = ra.wc + c
                     if wtcolx <= self.max_nonjunk:
                         self.next.cell(ra.rr + r, ra.rc + c, ra.wr + r, ra.wc + c)
         if self.max != self.max_nonjunk:
             logger.debug("Number of columns trimmed from %d to %d for sheet %r",
                          self.max + 1,
                          self.max_nonjunk + 1,
                          quoted_sheet_name(self.wtsheet_name))
     self.start(chain=False)
Beispiel #5
0
from xlrd import open_workbook
from xlutils.display import quoted_sheet_name
from xlutils.display import cell_display

wb = open_workbook('source.xls')

print quoted_sheet_name(wb.sheet_names()[0])
print repr(quoted_sheet_name(u'Price(\xa3)', 'utf-8'))
print quoted_sheet_name(u'My Sheet')
print quoted_sheet_name(u"John's Sheet")

sheet = wb.sheet_by_index(0)
print cell_display(sheet.cell(1, 1))
print cell_display(sheet.cell(1, 3), wb.datemode)
from xlrd import open_workbook
from xlutils.display import quoted_sheet_name
from xlutils.display import cell_display

wb = open_workbook('source.xls')

print quoted_sheet_name(wb.sheet_names()[0])
print repr(quoted_sheet_name(u'Price(\xa3)','utf-8'))
print quoted_sheet_name(u'My Sheet')
print quoted_sheet_name(u"John's Sheet")

sheet = wb.sheet_by_index(0)
print cell_display(sheet.cell(1,1))
print cell_display(sheet.cell(1,3),wb.datemode)