Save the contents of the table. If a cell is empty, it enters into the table None. How can this be intercepted, so that if None then nothing is recorded in the cell?
def save_file(self): filename = (QFileDialog.getSaveFileName(self, 'Сохранить', '', ".xls(*.xls)")) wbk = xlwt.Workbook() sheet = wbk.add_sheet("схема", cell_overwrite_ok=True) self.s_f(sheet) wbk.save(filename) def s_f(self, sheet): for currentColumn in range(self.table.columnCount()): for currentRow in range(self.table.rowCount()): my_icon = str(self.table.item(currentRow, currentColumn)) sheet.write(currentRow, currentColumn, my_icon)
str()with everything called. Try this:if item is not None: sheet.write(...)- jfs