Exemple #1
0
    def run(self):
        #getting a list of documents file name and its respective paths
        documents, documents_path = Invoice.get_files(self.path)
        print('Fetched files')

        #getting a list of word counts of the document
        wordcount = Invoice.all_file_wordcount(documents_path)
        print('Fetched word counts')

        #list of rounded off word counts
        dummy_count = Invoice.dummy_wordcount(wordcount)
        print('Fetched dummy count')

        #list of properties
        property_create, property_modified, property_title = Invoice.getProperties(
            documents_path)
        print('Fetched properties')

        #getting list of values
        property_values = Invoice.proper_properties(
            documents, property_title, property_create, property_modified,
            wordcount, dummy_count, self.title_bool, self.dummy_bool)
        print('Fetched proper properties')

        #fetch dictionary of data of properties
        data = Invoice.dictionary(property_values, self.title_bool,
                                  self.dummy_bool)
        print('Fetched Data')

        #drawing table
        table = Invoice.table(data)
        print('Table Drawn')

        #exporting the table to an excel file
        Invoice.export(table, self.file_path, self.filename)

        print('Invoice Saved')
Exemple #2
0
test file to check the working of invoice module
you can uncomment the variables below and store your local  file_path, path, filename, title_bool value and dummy_bool value

path as the name suggests is the path of the directory where all your docx file is stored or  saved
file_path is the path to the directory where you want to save your invoice excel file
filename is the name that you want to give to your excel file
title_bool is a boolean value that is set to False by default. This if changed to True will give you the title column of the table
dummy_bool is a boolean  value set to False by default that gives you round off value for your assumed word count
'''
##path = 'D:/python/alexda_project/docx'
##file_path = 'D:/python/alexda_project/docx/invoice'
##filename = 'demo2'
##title_bool = False
##dummy_bool = False

files_name, files_path = Invoice.get_files(path)
print('files:')
for i in range(len(files_name)):
    print(files_name[i])
print('\n\nfiles path: ')
for i in range(len(files_name)):
    print(files_path[i])

print('\n\nWordcounts:')
wordcount = Invoice.all_file_wordcount(files_path)
for i in range(len(wordcount)):
    print(wordcount[i])

print('\n\ndummy wordcounts:')
dummy = Invoice.dummy_wordcount(wordcount)
for i in range(len(dummy)):