Esempio n. 1
0
 def copy_sheet(self, ref_index, sheetname, cell_overwrite_ok=True):
     #print 'copy sheet..%s..%s' % (ref_index, sheetname)
     if not isinstance(sheetname, unicode):
         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)
     sht = self.__worksheets[ref_index].get_copy(sheetname)
     self.__worksheets.append(sht)
     return sht
Esempio n. 2
0
 def add_sheet(self, sheetname, cell_overwrite_ok=True):
     #print 'add sheet..%s' % (sheetname)
     if not isinstance(sheetname, unicode):
         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))
     #self.__drawing_group.add_sheet(self.get_sheet_count())
     return self.__worksheets[-1]
Esempio n. 3
0
    def copy_sheet_from_book(self, other_book, ref_index, sheetname, cell_overwrite_ok=True):
        #print 'copy sheet from book..%s..%s' % (ref_index, sheetname)
        if not isinstance(sheetname, unicode):
            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)

        other_sheet = other_book.get_sheet(ref_index)
        sheet = other_sheet.get_copy(sheetname, parent=self)
        self.__worksheets.append(sheet)
        self.__drawing_group.copy_from_other_group(other_book.drawing_group, other_sheet, sheet)
        return sheet