Esempio n. 1
0
 def onExportAll(self,event):
     """ """
     if not self._checkInputValid():
         return
     workbook = ConfigParser.OpenExcel(self.mConfigPath.text())
     for sheet in workbook.sheets():
         s = ConfigParser.ExcelSheetParser(sheet,self.mExportPath.text())
         s.Export()
     QMessageBox.information(self,"提示","导出完成")
Esempio n. 2
0
    def onExportSelect(self,event):
        """ """
        if not self._checkInputValid():
            return
        #找到需要导出的表
        export_sheet = []
        for i in range(self.mExcelTablesList.count()):
            cb = self.mExcelTablesList.itemWidget(self.mExcelTablesList.item(i))
            if cb.isChecked():
                export_sheet.append(cb.text())

        #执行导出
        workbook = ConfigParser.OpenExcel(self.mConfigPath.text())
        for sheet in workbook.sheets():
            if sheet.name in export_sheet:
                s = ConfigParser.ExcelSheetParser(sheet,self.mExportPath.text())
                s.Export()
        QMessageBox.information(self,"提示","导出完成")
Esempio n. 3
0
 def onSelectConfigPath(self,event):
     """ """
     fname = QFileDialog.getOpenFileName(self,"选择Excel",".","Excel(*.xlsx);;Excel(*.xls);;All(*.*)")
     if not fname or  fname[0] == '': #沒有选择文件
         return 
     excel_file = fname[0]
     if not excel_file.endswith(".xls") and not excel_file.endswith("xlsx"): 
         QMessageBox.critical(self,"出错提示","请选择Excel配置表")
         return
     if not os.path.exists(excel_file):
         QMessageBox.critical(self,"出错提示","配置表不存在!")
         return
     self.mConfigPath.setText(excel_file)
     #清除旧的数据
     self.mExcelTablesList.clear()
     workbook = ConfigParser.OpenExcel(self.mConfigPath.text())
     for sheetName in workbook.sheet_names():
         item = QListWidgetItem()
         cb   = QCheckBox(sheetName)
         self.mExcelTablesList.addItem(item)
         self.mExcelTablesList.setItemWidget(item,cb)