In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how to use Python to achieve batch generation of legal letters. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
Situational problem
Xiao Wang is a legal commissioner who will deal with infringement cases of his company and send legal letters to the infringers.
He will generate a legal letter to each sealed person in the [sealed list .xlsx] workbook according to the [legal letter template .docx] Word file.
To achieve this result, he needs to manually add the names and WeChat accounts of the sealing personnel in the [sealing list .xlsx] workbook to the corresponding location of the [legal letter template .docx] Word file, and save the [legal letter template .docx] Word file as a new file.
He has to repeat as many times as the number of people who seal the title. Take the first person as an example, the implementation process is as follows:
Implement with Python:
Code implementation: # case 1: batch generation of legal letters from docx import Documentfrom docx.shared import Ptfrom openpyxl import load_workbook # Open [sealed list .xlsx] workbook Get the [sealed personnel] worksheet title_wb = load_workbook ('.. / work / sealed list .xlsx') title_sheet = title_wb.active # traverse the data for row in title_sheet.iter_rows (min_row=2) in the [sealed personnel] worksheet Values_only=True): # get the "name" name = row [0] # get the "WeChat account" wxid = row [1] # Open the Word file doc = Document ('.. / work / legal letter template .docx') # get the sixth Paragraph object para = doc.paragraphs [5] # add the name of the person run_name = para.add_ Run (name) # font bold run_name.font.bold = True # font underlined run_name.font.underline = True # set font size to 14 pt run_name.font.size = Pt (14) # add seal personnel Wechat number run_wxid = para.add_run ('classmate (WeChat ID: {})' .format (wxid)) # set Set the font size to 14 pt run_wxid.font.size = Pt (14) # name and save the file to the [legal letter] folder doc.save ('.. / work / legal letter / legal letter-{} .docx '.format (name))
On "how to use Python to achieve batch generation of legal letters" this article is shared here, I hope the above content can be of some help to you, so that you can learn more knowledge, if you think the article is good, please share it out for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.