Spaces:
Running
Running
Update updated_word.py
Browse files- updated_word.py +9 -5
updated_word.py
CHANGED
|
@@ -568,10 +568,7 @@ def process_paragraphs(document, flat_json):
|
|
| 568 |
replacements_made += 1
|
| 569 |
return replacements_made
|
| 570 |
|
| 571 |
-
def main():
|
| 572 |
-
json_path = 'updated_word_data.json'
|
| 573 |
-
docx_path = 'test.docx'
|
| 574 |
-
output_path = 'updated_reportv1.docx'
|
| 575 |
|
| 576 |
try:
|
| 577 |
json_data = load_json(json_path)
|
|
@@ -602,4 +599,11 @@ def main():
|
|
| 602 |
traceback.print_exc()
|
| 603 |
|
| 604 |
if __name__ == "__main__":
|
| 605 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 568 |
replacements_made += 1
|
| 569 |
return replacements_made
|
| 570 |
|
| 571 |
+
def main(json_path, docx_path, output_path):
|
|
|
|
|
|
|
|
|
|
| 572 |
|
| 573 |
try:
|
| 574 |
json_data = load_json(json_path)
|
|
|
|
| 599 |
traceback.print_exc()
|
| 600 |
|
| 601 |
if __name__ == "__main__":
|
| 602 |
+
import sys
|
| 603 |
+
if len(sys.argv) != 4:
|
| 604 |
+
print("Usage: python updated_word.py <input_docx> <updated_json> <output_docx>")
|
| 605 |
+
exit(1)
|
| 606 |
+
docx_path = sys.argv[1]
|
| 607 |
+
json_path = sys.argv[2]
|
| 608 |
+
output_path = sys.argv[3]
|
| 609 |
+
main(json_path, docx_path, output_path)
|