예제 #1
0
def main():
    """
    使用方法:
    set datas=datas/
    set excel=xlsx/stall.xlsx
    set targets=json py
    echo on
    xlsx2py.exe %datas% %excel% %targets%
    """
    try:
        outfile = sys.argv[1]
    except Exception as err:
        print(main.__doc__, err)
        return

    infile = sys.argv[2]
    print("开始导表:[%s]" % (infile))
    if os.path.isfile(infile):
        targets = sys.argv[3:]
        a = xlsx2py(infile, outfile, targets)
        xlsxtool.exportMenu(config.EXPORT_INFO_OK)
        a.run()
    else:
        xlsxError.error_input(config.EXPORT_ERROR_NOEXISTFILE, (infile, ))
    print(
        '-------------------------------THE END------------------------------------------------'
    )

    sys.exit()
예제 #2
0
	def onSth4Nth(self):
		"""
		"""
		if not hasattr(self, 'mapIndex'):
			self.xlsxClear(EXPORT_ERROR_NOMAP)

		if len(self.__exportSheetIndex) == 0:
			xlsxError.error_input(EXPORT_ERROR_NOSHEET)

		return
예제 #3
0
	def onSth4Nth(self):
		"""
		"""
		if not hasattr(self, 'mapIndex'):
			self.xlsxClear(EXPORT_ERROR_NOMAP)

		if len(self.__exportSheetIndex) == 0:
			xlsxError.error_input(EXPORT_ERROR_NOSHEET)

		return
예제 #4
0
    def sth4Nth(self):
        """
        something for nothing, 代对表和导入表需要有
        """

        # 获得所有需要导出的表
        for sheetName in self.xbook.getSheetNames():
            if sheetName.startswith(config.EXPORT_PREFIX_CHAR):
                self.__exportSheetName.append(sheetName)

        # 检查是否有代对表
        if not self.xbook.getSheetBySheetName(config.EXPORT_MAP_SHEET):
            self.xlsxClear(config.EXPORT_ERROR_NOMAP)

        # 检查导出表数量
        if len(self.__exportSheetName) == 0:
            xlsxError.error_input(config.EXPORT_ERROR_NOSHEET)
예제 #5
0
def main():
	"""
	使用方法:
	python xlsx2py excelName.xls(x) data.py
	"""
	try:
		outfile = sys.argv[1]
	except:
		print( main.__doc__ )
		return
	
	for infile in sys.argv[2:]:
		print( "开始导表:[%s] max=%i" % (infile, len(sys.argv[2:])) )
		if os.path.isfile(infile):
			a = xlsx2py(infile, outfile)
			xlsxtool.exportMenu(EXPORT_INFO_OK)
			a.run()
		else:
			xlsxError.error_input(EXPORT_ERROR_NOEXISTFILE, (infile,))
		print( '-------------------------------THE END------------------------------------------------' )
	
	sys.exit()
예제 #6
0
def main():
	"""
	使用方法:
	python xlsx2py excelName.xls(x) data.py
	"""
	try:
		outfile = sys.argv[1]
	except:
		print( main.__doc__ )
		return
	
	for infile in sys.argv[2:]:
		print( "开始导表:[%s] max=%i" % (infile, len(sys.argv[2:])) )
		if os.path.isfile(infile):
			a = xlsx2py(infile, outfile)
			xlsxtool.exportMenu(EXPORT_INFO_OK)
			a.run()
		else:
			xlsxError.error_input(EXPORT_ERROR_NOEXISTFILE, (infile,))
		print( '-------------------------------THE END------------------------------------------------' )
	
	sys.exit()