import docx
from docx import Document
import tkinter as tk
from tkinter import filedialog
import os
path = filedialog.askdirectory()
name = os.listdir(path+'/')
for i in name:
if os.path.isfile(i) == False:
docx = Document(path+'/'+i+'/'+i+'_草原確權牧戶資訊采集表.docx')
table = docx.tables
tb1 = table[0]
run = tb1.cell(2,6).paragraphs[0].add_run(tb1.cell(2,6).text)
run.font.name = ('BZDBT')
run.font.size = 140000
tb1.cell(2,6).paragraphs[0].alignment = WD_PARAGRAPH_ALIGNMENT.CENTER
docx.save(path+'/'+i+'/'+i+'_草原確權牧戶資訊采集表.docx')
print('成功修改一宗')
else:
print('不是檔案') ;;;;一直就在前面提示縮進報錯。。。。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/113814.html
標籤:其他開發語言
