Exemplo n.º 1
0
	def add_plates_sheet(self,sheetname,cell_overwrite_ok=False):
		if not isinstance(sheetname, unicode_type):
			sheetname			= sheetname.decode(self.encoding)
		if not Utils.valid_sheet_name(sheetname):
			raise Exception("invalid worksheet name %r" % sheetname)
		lower_name = sheetname.lower()
		if lower_name in self._Workbook__worksheet_idx_from_name:
			raise Exception("duplicate worksheet name %r" % sheetname)
		self._Workbook__worksheet_idx_from_name[lower_name] = len(self._Workbook__worksheets)
		self._Workbook__worksheets.append(PlatesSheet(sheetname,self,cell_overwrite_ok))
		return self._Workbook__worksheets[-1]
Exemplo n.º 2
0
 def add_sheet(self, sheetname, cell_overwrite_ok=False):
     from xlwt import Worksheet, Utils
     if not isinstance(sheetname, str):
         sheetname = sheetname.decode(self.encoding)
     if not Utils.valid_sheet_name(sheetname):
         raise Exception("invalid worksheet name %r" % sheetname)
     lower_name = sheetname.lower()
     if lower_name in self.__worksheet_idx_from_name:
         raise Exception("duplicate worksheet name %r" % sheetname)
     self.__worksheet_idx_from_name[lower_name] = len(self.__worksheets)
     self.__worksheets.append(Worksheet(sheetname, self, cell_overwrite_ok))
     return self.__worksheets[-1]
Exemplo n.º 3
0
print (0,0),'->',Utils.rowcol_to_cell(0,0)
print (0,0,False,True),'->',
print Utils.rowcol_to_cell(0,0,False,True)
print (0,0,True,True),'->',
print Utils.rowcol_to_cell(
          row=0,col=0,row_abs=True,col_abs=True
          )

print '1:3 ->',Utils.cellrange_to_rowcol_pair('1:3')
print 'B:G ->',Utils.cellrange_to_rowcol_pair('B:G')
print 'A2:B7 ->',Utils.cellrange_to_rowcol_pair('A2:B7')
print 'A1 ->',Utils.cellrange_to_rowcol_pair('A1')

print (0,0,100,100),'->',
print Utils.rowcol_pair_to_cellrange(0,0,100,100)
print (0,0,100,100,True,False,False,False),'->',
print Utils.rowcol_pair_to_cellrange(
          row1=0,col1=0,row2=100,col2=100,
          row1_abs=True,col1_abs=False,
          row2_abs=False,col2_abs=True
          )

for name in (
    '',"'quoted'","O'hare","X"*32,"[]:\\?/*\x00"
    ):
    print 'Is %r a valid sheet name?' % name,
    if Utils.valid_sheet_name(name):
        print "Yes"
    else:
        print "No"
Exemplo n.º 4
0
print(0, 0), '->', Utils.rowcol_to_cell(0, 0)
print(0, 0, False, True), '->',
print Utils.rowcol_to_cell(0, 0, False, True)
print(0, 0, True, True), '->',
print Utils.rowcol_to_cell(row=0, col=0, row_abs=True, col_abs=True)

print '1:3 ->', Utils.cellrange_to_rowcol_pair('1:3')
print 'B:G ->', Utils.cellrange_to_rowcol_pair('B:G')
print 'A2:B7 ->', Utils.cellrange_to_rowcol_pair('A2:B7')
print 'A1 ->', Utils.cellrange_to_rowcol_pair('A1')

print(0, 0, 100, 100), '->',
print Utils.rowcol_pair_to_cellrange(0, 0, 100, 100)
print(0, 0, 100, 100, True, False, False, False), '->',
print Utils.rowcol_pair_to_cellrange(row1=0,
                                     col1=0,
                                     row2=100,
                                     col2=100,
                                     row1_abs=True,
                                     col1_abs=False,
                                     row2_abs=False,
                                     col2_abs=True)

for name in ('', "'quoted'", "O'hare", "X" * 32, "[]:\\?/*\x00"):
    print 'Is %r a valid sheet name?' % name,
    if Utils.valid_sheet_name(name):
        print "Yes"
    else:
        print "No"
from xlwt import Utils

print Utils.col_by_name('AA')
print Utils.col_by_name('A')

print Utils.cell_to_rowcol('A1')
print Utils.cell_to_rowcol('$A$1')

print Utils.cell_to_rowcol2('A1')

print Utils.rowcol_to_cell(0,0)
print Utils.rowcol_to_cell(0,0,False,True)
print Utils.rowcol_to_cell(
    row=0,col=0,row_abs=True,col_abs=True
    )

print Utils.cellrange_to_rowcol_pair('1:3')
print Utils.cellrange_to_rowcol_pair('B:G')
print Utils.cellrange_to_rowcol_pair('A2:B7')
print Utils.cellrange_to_rowcol_pair('A1')

print Utils.valid_sheet_name('')
print Utils.valid_sheet_name("'quoted'")
print Utils.valid_sheet_name("O'hare")
print Utils.valid_sheet_name("X"*32)
print Utils.valid_sheet_name("[]:\\?/*\x00")
Exemplo n.º 6
0
from xlwt import Utils

print Utils.col_by_name('AA')
print Utils.col_by_name('A')

print Utils.cell_to_rowcol('A1')
print Utils.cell_to_rowcol('$A$1')

print Utils.cell_to_rowcol2('A1')

print Utils.rowcol_to_cell(0, 0)
print Utils.rowcol_to_cell(0, 0, False, True)
print Utils.rowcol_to_cell(row=0, col=0, row_abs=True, col_abs=True)

print Utils.cellrange_to_rowcol_pair('1:3')
print Utils.cellrange_to_rowcol_pair('B:G')
print Utils.cellrange_to_rowcol_pair('A2:B7')
print Utils.cellrange_to_rowcol_pair('A1')

print Utils.valid_sheet_name('')
print Utils.valid_sheet_name("'quoted'")
print Utils.valid_sheet_name("O'hare")
print Utils.valid_sheet_name("X" * 32)
print Utils.valid_sheet_name("[]:\\?/*\x00")