示例#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)
示例#2
0
文件: filter.py 项目: dhyams/xlutils
 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)
示例#3
0
文件: filter.py 项目: dhyams/xlutils
 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)
示例#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)
示例#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)