

from docx import Document
import os
import sys

comment = "////////////////////////////////////////////////";
line_return = "\n"
line_break = "\r"
write_buffer = ""

test_description = ['test1', 'test2', 'test3', 'test4']
test_list = ['test1', 'test2', 'test3', 'test4']

def copy_header():

    fname = "template.v"

    # create template file
    open(fname, 'a').close()

    # copy header to templace
    with open("header.txt") as f:
      with open(fname, "w") as f1:
        for line in f:
            f1.write(line)
    f.close
    f1.close

#https://jugad2.blogspot.com/2013/09/extract-text-from-word-docx-files-with.html
    
def generator():

    fname = "template.v"
    # add text in file - append
    f = open(fname, "a")

    f.write(line_break)
    f.write(line_break)
    
    f.write("Now the file has one more line!") 
    f.close 


def getText():
    document = Document('toto.docx')
    for para in document.paragraphs:
        print(para.text)

    #for para in doc.paragraphs:
    #    fullText.append(para.text)

    fullText = []
    for para in document.paragraphs:
        fullText.append(para.text)
    print(fullText[5])    
    #return '\n'.join(fullText)    


def main():
    getText()
    copy_header()
    generator()
    
if __name__ == "__main__":
    status = main()
    sys.exit(status)
