def buildOneExcelFile(excelfile='sourceLanguage.xls', dest_dir='.\language', sheetIndex=0): xlsObj['xls'] = excelfile xlsObj['col'] = 65 for icol in excelPack.getAllColsBySheetIndex(sheetIndex, excelfile): xlsObj['col'] = xlsObj['col'] + 1 buildOne(icol, dest_dir) xlsObj['col'] = 0
def buildKeysTable(self, keyMap, sheetIndex=0): iCnt = 65 for icol in excelPack.getAllColsBySheetIndex(sheetIndex, self.xls): if self.getColDetail(icol, keyMap) is True: self.wordMap[self.key] = icol # 排除前两行信息行 self.cloMap[self.key] = iCnt self.keyOrder += self.key else: self.xprint() iCnt += 1 self.col = iCnt print("self.keyOrder = ", self.keyOrder)
def buildKeysTable(self, keyMap, sheetIndex=0): iCnt = 65 for icol in excelPack.getAllColsBySheetIndex(sheetIndex, self.xls): if self.getColDetail(icol, keyMap) is True: self.wordMap[self.key] = icol # 排除前两行信息行 self.cloMap[self.key] = iCnt self.keyOrder += self.key else: self.xprint() iCnt += 1 self.col = iCnt print('self.keyOrder = ', self.keyOrder)
def __init__(self, xls, keys = 'SEBaLITtFGHVRPA', msgHandle = None): ''' 构造函数,输入 Excle 表中的数据 ''' self.tables = [] self.curCol = 1 self.curIndex = 1 self.fileCnt = 0 self.xlsName = os.path.basename(xls) self.dest = os.path.join(Desktop, 'objs') self.colNameOrder = '' # 表中有效列的顺序 self.keyNameOrder = '' # 表中有效列key的顺序 self.curPlatformName = '' self.tarObj = None self.outKeys = keys self.errMap = {} self.msgHandle = msgHandle self.buildKeysTable(excelPack.getAllColsBySheetIndex(0, xls)) self.difMap = ExcleInput.GetSpecialMap(self.getColBykey('S'))
def __init__(self, xls, keys='SEBaLITtFGHVRPA', msgHandle=None): ''' 构造函数,输入 Excle 表中的数据 ''' self.tables = [] self.curCol = 1 self.curIndex = 1 self.fileCnt = 0 self.xlsName = os.path.basename(xls) self.dest = os.path.join(Desktop, 'objs') self.colNameOrder = '' # 表中有效列的顺序 self.keyNameOrder = '' # 表中有效列key的顺序 self.curPlatformName = '' self.tarObj = None self.outKeys = keys self.errMap = {} self.msgHandle = msgHandle self.buildKeysTable(excelPack.getAllColsBySheetIndex(0, xls)) self.difMap = ExcleInput.GetSpecialMap(self.getColBykey('S'))
from string import Template import copy import excelPack from rules import Rules xls = 'NewArch.xls' oneColFileCnt = 27 # 每列可生成27个文件 xlsTableOrder = 'SEBaLITtFGHVRPA' # 表格中有效列key的顺序 xlsColOrder = 'ADFGHIJKLMNOPQR' # 表格中有效列头的顺序 outPutFileNum = oneColFileCnt * len(xlsTableOrder) # 整个表格可生成的文件数 xlsCols = excelPack.getAllColsBySheetIndex(0, xls) # cfg = Rules('cutter.ini') # CheckTextTemplate = Template(cfg['Format']['textFormat']) # CheckTextTemplate = Template('${key}\t${value}\t${encode}') class Cell(): def __init__(self, dict_): super(Cell, self).__init__() self.Dict2Obj(dict_) def Dict2Obj(self, dict_): for att in dict_: setattr(self, att, dict_[att]) def Obj2Dict(self): _dict = { att:getattr(self, att) for att in dir(self)\ if att[0:2] != '__' and not callable(getattr(self, att))} return _dict
''' Created on 2013年10月12日 @author: Administrator ''' from excelInput import ExcleInput import copy import excelPack import unittest xls = 'NewArch.xls'; oneColFileCnt = 27 # 每列可生成27个文件 xlsTableOrder = 'SEBaLITtFGHVRPA' # 表格中有效列key的顺序 xlsColOrder = 'ADFGHIJKLMNOPQR' # 表格中有效列头的顺序 outPutFileNum = oneColFileCnt * len(xlsTableOrder) # 整个表格可生成的文件数 xlsCols = excelPack.getAllColsBySheetIndex(0, xls) ei = ExcleInput(xls, xlsTableOrder) xlstTables = [iCol for i, iCol in enumerate(xlsCols)\ if ExcleInput.CheckOneCol(iCol) is not False \ and not iCol.insert(0, ExcleInput.CheckOneCol(iCol)) ] def getRangeByKey(key, begin = 0 , end = None): col = xlstTables[xlsTableOrder.index(key)] if end == None: return col [begin:] else: return col [begin:end + 1] difMap = { '30': ['S/_16_=向右键切换输入法,向左键表示删除键', 'S/_100_=向左键', 'S/_101_=向右键'], '35': ['S/_16_=*键切换输入法,#键输入空格', 'S/_100_=*', 'S/_101_=#'] }