{"id":869,"date":"2023-06-09T16:17:37","date_gmt":"2023-06-09T08:17:37","guid":{"rendered":"https:\/\/kuo.us.to\/wordpress\/?p=869"},"modified":"2023-06-09T16:58:22","modified_gmt":"2023-06-09T08:58:22","slug":"python%e5%ad%b8%e7%bf%92%e7%ad%86%e8%a8%98-%e6%89%b9%e6%ac%a1%e8%a8%ad%e5%ae%9aword-docx%e6%aa%94%e5%a2%9e%e5%8a%a0%e9%a0%81%e9%a6%96%e5%8f%8a%e9%a0%81%e5%b0%be%e5%90%ab%e8%a8%ad%e5%ae%9a%e4%b8%ad","status":"publish","type":"post","link":"https:\/\/kuo.us.to\/wordpress\/python%e5%ad%b8%e7%bf%92%e7%ad%86%e8%a8%98\/869\/","title":{"rendered":"Python\u5b78\u7fd2\u7b46\u8a18: \u6279\u6b21\u8a2d\u5b9aword docx\u6a94\u589e\u52a0\u9801\u9996\u53ca\u9801\u5c3e(\u542b\u8a2d\u5b9a\u4e2d\u6587\u5b57\u9ad4)"},"content":{"rendered":"\n<h3>\u7814\u7a76\u4e86\u597d\u5e7e\u5929\uff0cword\u6279\u6b21\u589e\u52a0\u9801\u9996\u548c\u9801\u5c3e\u6709\u4e00\u4e9b\u5148\u5929\u4e0a\u7684\u9650\u5236!!<\/h3>\n\n\n\n<p><code>python\u7684docx\u6a21\u7d44\u529f\u80fd\u5f88\u5f37\uff0c\u4f46\u9084\u662f\u6709\u90e8\u4efd\u529f\u80fd\u529b\u6709\u672a\u902e\u3002<\/code><\/p>\n\n\n\n<p>\u9996\u5148\u5728\u7d14word\u6a94\u4e0b\u4ee5docx\u6a21\u7d44\u8b80\u53d6\u6a94\u6848\u5f8c\uff0c<br>\u662f\u7121\u6cd5\u5206\u8fa8\u51fa\u9801\u9762\u5167\u5bb9\u7684Soft Break!!<\/p>\n\n\n\n<p>Soft Break\u5c31\u662f\u6211\u5011\u5728\u6253word\u6587\u4ef6\u6642\uff0c\u8d85\u904e\u4e00\u9801\u6642\uff0cword\u6703\u81ea\u52d5\u5e6b\u4f60\u628a\u5167\u5bb9\u653e\u5230\u4e0b\u4e00\u9801\u3002<br>\u53e6\u5916\u6709\u4e9b\u4eba\u6703\u4ee5\u4e00\u76f4\u63db\u884c\u4f86\u5206\u9801\uff0c\u9019\u500b\u4e5f\u662fSoft Break\uff0c\u9019\u7a2e\u65b9\u5f0f\u5728\u7a0b\u5f0f\u4e2d\u90fd\u7121\u6cd5\u5206\u8fa8\u8df3\u9801\u3002<\/p>\n\n\n\n<p>docx\u6a21\u7d44\u53ef\u4ee5\u5206\u8fa8\u7684\u662fHard Break\uff0c\u4e5f\u5c31\u662f\u624b\u52d5\u7684\u300c\u5206\u9801\u7b26\u865f\u300d\u548c\u300c\u5206\u7bc0\u7b26\u865f\u300d\u3002<\/p>\n\n\n\n<h3>\u6240\u4ee5\u4f60\u7684word\u6a94\u6848\u5982\u679c\u8981\u5c07\u9801\u6578\u7b49\u8cc7\u6599\u653e\u5230\u9801\u9996\u548c\u9801\u5c3e\u7684\u8a71\uff0c\u8acb\u679c\u65b7\u653e\u68c4\uff0c\u601d\u8003\u5176\u4ed6\u89e3\u6c7a\u65b9\u6848!!<\/h3>\n\n\n\n<h4><code><span class=\"has-inline-color has-vivid-red-color\">\u5982\u679c\u4f60\u4e0d\u662f\u4e0a\u9762\u7684\u9700\u6c42\uff0c\u518d\u7e7c\u7e8c\u5f80\u4e0b\u770b\u3002<\/span><\/code><\/h4>\n\n\n\n<p>\u5047\u8a2d\u67092\u500bword\u6587\u4ef6\uff0c<br>\u7b2c1\u500b\u6587\u4ef6\u8981\u5728\u6240\u6709\u9801\u9762\u7684\u9801\u9996\u548c\u9801\u5c3e\u52a0\u4e0a\u6a94\u540d\u300c\u9644\u4ef61-1_XXXXXX.docx\u300d\u7684\u524d\u5e7e\u500b\u5b57\u300c\u9644\u4ef61-1\u300d\u3002<br>\u7b2c2\u500b\u6587\u4ef6\u8981\u5728\u6240\u6709\u9801\u9762\u7684\u9801\u9996\u548c\u9801\u5c3e\u52a0\u4e0a\u6a94\u540d\u300c\u9644\u4ef62-1_XXXXXX.docx\u300d\u7684\u524d\u5e7e\u500b\u5b57\u300c\u9644\u4ef62-1\u300d\u3002<\/p>\n\n\n\n<p>\u76ee\u6a19\u8cc7\u6599\u593e\u6a94\u6848\u5982\u4e0b\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"631\" height=\"253\" src=\"https:\/\/kuo.us.to\/wordpress\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-09-00.jpg\" alt=\"\" class=\"wp-image-875\" srcset=\"https:\/\/kuo.us.to\/wordpress\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-09-00.jpg 631w, https:\/\/kuo.us.to\/wordpress\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-09-00-300x120.jpg 300w\" sizes=\"(max-width: 631px) 100vw, 631px\" \/><\/figure>\n\n\n\n<p>\u9644\u4ef61-1_Word\u793a\u7bc4\u6587\u4ef6_\u76f4.docx\u7684\u9801\u9996\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"383\" src=\"https:\/\/kuo.us.to\/wordpress\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-09-01-1024x383.jpg\" alt=\"\" class=\"wp-image-876\" srcset=\"https:\/\/kuo.us.to\/wordpress\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-09-01-1024x383.jpg 1024w, https:\/\/kuo.us.to\/wordpress\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-09-01-300x112.jpg 300w, https:\/\/kuo.us.to\/wordpress\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-09-01-768x287.jpg 768w, https:\/\/kuo.us.to\/wordpress\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-09-01.jpg 1367w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u9644\u4ef61-1_Word\u793a\u7bc4\u6587\u4ef6_\u76f4.docx\u7684\u9801\u5c3e\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"616\" src=\"https:\/\/kuo.us.to\/wordpress\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-09-02-1-1024x616.jpg\" alt=\"\" class=\"wp-image-878\" srcset=\"https:\/\/kuo.us.to\/wordpress\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-09-02-1-1024x616.jpg 1024w, https:\/\/kuo.us.to\/wordpress\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-09-02-1-300x180.jpg 300w, https:\/\/kuo.us.to\/wordpress\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-09-02-1-768x462.jpg 768w, https:\/\/kuo.us.to\/wordpress\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-09-02-1.jpg 1247w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u9644\u4ef62-1_Word\u793a\u7bc4\u6587\u4ef6_\u6a6b.docx\u7684\u9801\u9996\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"483\" src=\"https:\/\/kuo.us.to\/wordpress\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-09-03-1024x483.jpg\" alt=\"\" class=\"wp-image-879\" srcset=\"https:\/\/kuo.us.to\/wordpress\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-09-03-1024x483.jpg 1024w, https:\/\/kuo.us.to\/wordpress\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-09-03-300x141.jpg 300w, https:\/\/kuo.us.to\/wordpress\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-09-03-768x362.jpg 768w, https:\/\/kuo.us.to\/wordpress\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-09-03.jpg 1277w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u9644\u4ef62-1_Word\u793a\u7bc4\u6587\u4ef6_\u6a6b.docx\u7684\u9801\u5c3e\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"501\" src=\"https:\/\/kuo.us.to\/wordpress\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-09-04-1024x501.jpg\" alt=\"\" class=\"wp-image-880\" srcset=\"https:\/\/kuo.us.to\/wordpress\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-09-04-1024x501.jpg 1024w, https:\/\/kuo.us.to\/wordpress\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-09-04-300x147.jpg 300w, https:\/\/kuo.us.to\/wordpress\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-09-04-768x376.jpg 768w, https:\/\/kuo.us.to\/wordpress\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-09-04.jpg 1233w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u793a\u7bc4\u7a0b\u5f0f\u78bc\u5982\u4e0b\uff1a<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nimport os\nimport re\nfrom docx import Document\nfrom docx.shared import Pt, Cm\nfrom docx.oxml.ns import qn\nfrom docx.enum.text import WD_ALIGN_PARAGRAPH\n\n# \u8a2d\u5b9a\u76ee\u6a19\u8cc7\u6599\u593e\nfile_path = &quot;d:\\\\temp\\\\test&quot;\n \n# \u627e\u51fa\u6240\u6709doc\u6a94\u505a\u6210list\nfiles = &#x5B;x for x in os.listdir(file_path) if x.endswith(&quot;.docx&quot;)]\n\nfor file in files:\n    # Regex\u7b2c\u4e00\u7d44\u62ec\u865f\u662f\u8981\u627e\u51fa\u9644\u4ef6\u25cb-\u25cb\uff0c\u505a\u70ba\u9801\u9996\u7684\u6587\u4ef6\n    pattern = '(\u9644\u4ef6\\d+-\\d)_.+(.docx?$)'\n    target = re.findall(pattern, file)\n    \n    # \u627e\u51fa\u7b26\u5408Regex\u70bapattern\u7684\u6a94\u6848\n    if target:\n        print(file)\n        \n        # header\u70ba\u9801\u9996\u3001\u9801\u5c3e\u7684\u6587\u5b57\n        header = target&#x5B;0]&#x5B;0]\n        print(header)\n     \n        # \u76ee\u6a19docx\u6a94\u6848\n        docx_file = os.path.join(file_path, file)\n        \n        # \u52a0\u5165\u9801\u9996\u5f8c\u4e4bdocx\u5b58\u6a94\u547d\u540d\n        edited_docx_file = os.path.join(file_path, os.path.splitext(file)&#x5B;0] + &quot;_edited&quot; + &quot;.docx&quot;)\n        \n        # \u958b\u555f\u76ee\u6a19docx\u6a94\u6848\n        document = Document(docx_file)\n        \n        # \u5982\u679c\u6587\u4ef6\u6709\u5206\u7bc0\uff0c\u8981\u904d\u6b77\u6240\u6709\u7684\u5206\u7bc0\uff0c\u5982\u679c\u6587\u4ef6\u6c92\u6709\u5206\u7bc0\uff0c\u90a3\u5c31\u53ef\u4ee5\u76f4\u63a5\u7528document.sections&#x5B;0]\u4f86\u8655\u7406\uff0c\u4e0d\u9700\u8981\u904d\u6b77\n        for section in document.sections:\n            \n            ## \u4ee5\u4e0b\u9801\u9996\u7684\u9644\u4ef6\u6587\u4ef6\u8981\u5728\u9801\u9762\u5de6\u3001\u53f3\u5169\u908a\u90fd\u52a0\uff0c\u6240\u4ee5\u8981\u53e6\u5916\u505a\u5224\u65b7\uff0c\u8b93\u6587\u4ef6\u7684\u5de6\u53f3\u53ef\u4ee5\u5728\u6b63\u78ba\u7684\u4f4d\u7f6e\u5448\u73fe\u9644\u4ef6\u7684\u6587\u5b57\n            ## ---------------------------------------------------------------------------------\n            ## \u7372\u53d6\u9801\u9762\u5bec\u5ea6\n            #page_width = section.page_width\n            \n            ## \u7372\u53d6\u9801\u9762\u9ad8\u5ea6\n            #page_height = section.page_height\n            \n            ## \u5047\u8a2d\u6587\u4ef6\u90fd\u662fA4\u76f4\u5f0f\u6216\u6a6b\u5f0f\uff0c\u4ee5\u4e0b\u70ba\u5224\u65b7\u6587\u4ef6\u662f\u76f4\u5f0f\u6216\u6a6b\u5f0f\n            \n            ## \u5047\u5982\u9801\u9762\u9ad8\u5ea6\u5927\u65bc\u9801\u9762\u5bec\u5ea6\uff0c\u90a3\u5c31\u662fA4\u76f4\u5f0f\n            #if page_height &gt; page_width:\n            #    mytext = header + &quot;\\t&quot;*15 + &quot;       &quot; + header\n            #\n            ## \u5047\u5982\u9801\u9762\u9ad8\u5ea6\u6c92\u6709\u5927\u65bc\u9801\u9762\u5bec\u5ea6\uff0c\u90a3\u5c31\u662fA4\u6a6b\u5f0f\n            #else:\n            #    my_header = header + &quot;\\t&quot;*23 + &quot;       &quot; + header\n            ## ---------------------------------------------------------------------------------\n            \n            mytext = header\n\n            print(f'\u6b63\u5728\u8655\u7406{docx_file}')\n            print('----------------------')\n            \n            # \u958b\u59cb\u8655\u7406\u9801\u9996\n            # --------------------------------------------------\n            h_paragraph = section.header.paragraphs&#x5B;0]\n            \n            # \u8a2d\u5b9a\u9801\u9996\u683c\u5f0f\n            h_paragraph_format = h_paragraph.paragraph_format\n            \n            # \u8a2d\u5b9a\u9801\u9996\u9760\u53f3\u5c0d\u9f4a\n            h_paragraph_format.alignment = WD_ALIGN_PARAGRAPH.RIGHT\n            \n            # \u8a2d\u5b9a\u9801\u9996\u7f6e\u4e2d\u5c0d\u9f4a\n            #h_paragraph_format.alignment = WD_ALIGN_PARAGRAPH.CENTER\n            \n            # \u8a2d\u5b9a\u9801\u9996\u9760\u5de6\u5c0d\u9f4a\uff08\u5167\u5b9a\u70ba\u9760\u5de6\u5c0d\u9f4a\uff0c\u6240\u4ee5\u4e0d\u5beb\u662f\u4e00\u6a23\u7684\u6548\u60b2\uff09\n            #h_paragraph_format.alignment = WD_ALIGN_PARAGRAPH.LEFT\n            \n            # \u4ee5\u4e0b\u662f\u5c07\u9801\u9996\u8cc7\u6599\u5957\u7528\u5230\u6587\u4ef6\n            h_run = h_paragraph.add_run(mytext)\n                    \n            # \u9019\u500b\u662f\u8a2d\u5b9a\u7c97\u9ad4\n            h_run.bold = True\n            \n            # \u9019\u500b\u662f\u8a2d\u5b9a\u5b57\u9ad4\u5927\u5c0f\u70ba14\n            h_run.font.size = Pt(14)\n            \n            # \u9019\u500b\u662f\u8a2d\u5b9a\u82f1\u6587\u6578\u5b57\u70ba Times New Roman\u5b57\u578b\n            h_run.font.name = 'Times New Roman'\n            \n            # \u9019\u500b\u662f\u8a2d\u5b9a\u4e2d\u6587\u70ba\u5fae\u8edf\u6b63\u9ed1\u9ad4\n            #h_run._element.rPr.rFonts.set(qn('w:eastAsia'), u'\u5fae\u8edf\u6b63\u9ed1\u9ad4')\n            \n            # \u9019\u500b\u662f\u8a2d\u5b9a\u4e2d\u6587\u70ba\u6a19\u6977\u9ad4\u5b57\u578b\n            h_run._element.rPr.rFonts.set(qn('w:eastAsia'), u'\u6a19\u6977\u9ad4')\n            # --------------------------------------------------\n            \n            # \u958b\u59cb\u8655\u7406\u9801\u5c3e\n            # --------------------------------------------------\n            f_paragraph = section.footer.paragraphs&#x5B;0]\n            \n            # \u8a2d\u5b9a\u9801\u5c3e\u683c\u5f0f\n            f_paragraph_format = f_paragraph.paragraph_format\n            \n            # \u8a2d\u5b9a\u9801\u5c3e\u9760\u53f3\u5c0d\u9f4a\n            f_paragraph_format.alignment = WD_ALIGN_PARAGRAPH.RIGHT\n            \n            # \u8a2d\u5b9a\u9801\u5c3e\u7f6e\u4e2d\u5c0d\u9f4a\n            #f_paragraph_format.alignment = WD_ALIGN_PARAGRAPH.CENTER\n            \n            # \u8a2d\u5b9a\u9801\u5c3e\u9760\u5de6\u5c0d\u9f4a\uff08\u5167\u5b9a\u70ba\u9760\u5de6\u5c0d\u9f4a\uff0c\u6240\u4ee5\u4e0d\u5beb\u662f\u4e00\u6a23\u7684\u6548\u60b2\uff09\n            #f_paragraph_format.alignment = WD_ALIGN_PARAGRAPH.LEFT\n            \n            # \u4ee5\u4e0b\u662f\u5c07\u9801\u5c3e\u8cc7\u6599\u5957\u7528\u5230\u6587\u4ef6\n            f_run = f_paragraph.add_run(mytext)\n                    \n            # \u9019\u500b\u662f\u8a2d\u5b9a\u7c97\u9ad4\n            f_run.bold = True\n            \n            # \u9019\u500b\u662f\u8a2d\u5b9a\u5b57\u9ad4\u5927\u5c0f\u70ba14\n            f_run.font.size = Pt(14)\n            \n            # \u9019\u500b\u662f\u8a2d\u5b9a\u82f1\u6587\u6578\u5b57\u70ba Times New Roman\u5b57\u578b\n            f_run.font.name = 'Times New Roman'\n            \n            # \u9019\u500b\u662f\u8a2d\u5b9a\u4e2d\u6587\u70ba\u5fae\u8edf\u6b63\u9ed1\u9ad4\n            #f_run._element.rPr.rFonts.set(qn('w:eastAsia'), u'\u5fae\u8edf\u6b63\u9ed1\u9ad4')\n            \n            # \u9019\u500b\u662f\u8a2d\u5b9a\u4e2d\u6587\u70ba\u6a19\u6977\u9ad4\u5b57\u578b\n            f_run._element.rPr.rFonts.set(qn('w:eastAsia'), u'\u6a19\u6977\u9ad4')\n            # --------------------------------------------------\n                            \n        document.save(edited_docx_file)    \n\nprint('\u6240\u6709word\u6a94\u52a0\u5165\u9644\u4ef6\u4e4b\u9801\u9996\u9801\u5c3e\uff1a\u5df2\u5b8c\u6210')\n<\/pre><\/div>\n\n\n<p>\u7a0b\u5f0f\u57f7\u884c\u7d50\u679c\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"422\" height=\"182\" src=\"https:\/\/kuo.us.to\/wordpress\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-09-05.jpg\" alt=\"\" class=\"wp-image-881\" srcset=\"https:\/\/kuo.us.to\/wordpress\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-09-05.jpg 422w, https:\/\/kuo.us.to\/wordpress\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-09-05-300x129.jpg 300w\" sizes=\"(max-width: 422px) 100vw, 422px\" \/><\/figure>\n\n\n\n<p>\u7a0b\u5f0f\u8655\u7406\u5b8c\u7684\u8cc7\u6599\u593e\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"578\" height=\"253\" src=\"https:\/\/kuo.us.to\/wordpress\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-09-06.jpg\" alt=\"\" class=\"wp-image-882\" srcset=\"https:\/\/kuo.us.to\/wordpress\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-09-06.jpg 578w, https:\/\/kuo.us.to\/wordpress\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-09-06-300x131.jpg 300w\" sizes=\"(max-width: 578px) 100vw, 578px\" \/><\/figure>\n\n\n\n<p>\u7a0b\u5f0f\u8655\u7406\u5b8c\u7684\u6a94\u6848\uff1a<\/p>\n\n\n\n<p>\u9644\u4ef61-1_Word\u793a\u7bc4\u6587\u4ef6_\u76f4_edited.docx\u7684\u9801\u9996\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"425\" src=\"https:\/\/kuo.us.to\/wordpress\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-09-07-1024x425.jpg\" alt=\"\" class=\"wp-image-883\" srcset=\"https:\/\/kuo.us.to\/wordpress\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-09-07-1024x425.jpg 1024w, https:\/\/kuo.us.to\/wordpress\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-09-07-300x124.jpg 300w, https:\/\/kuo.us.to\/wordpress\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-09-07-768x319.jpg 768w, https:\/\/kuo.us.to\/wordpress\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-09-07.jpg 1186w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u9644\u4ef61-1_Word\u793a\u7bc4\u6587\u4ef6_\u76f4_edited.docx\u7684\u9801\u5c3e\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"746\" src=\"https:\/\/kuo.us.to\/wordpress\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-09-08-1024x746.jpg\" alt=\"\" class=\"wp-image-884\" srcset=\"https:\/\/kuo.us.to\/wordpress\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-09-08-1024x746.jpg 1024w, https:\/\/kuo.us.to\/wordpress\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-09-08-300x219.jpg 300w, https:\/\/kuo.us.to\/wordpress\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-09-08-768x560.jpg 768w, https:\/\/kuo.us.to\/wordpress\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-09-08.jpg 1058w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u9644\u4ef62-1_Word\u793a\u7bc4\u6587\u4ef6_\u6a6b_edited.docx\u7684\u9801\u9996\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"560\" src=\"https:\/\/kuo.us.to\/wordpress\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-09-10-1024x560.jpg\" alt=\"\" class=\"wp-image-885\" srcset=\"https:\/\/kuo.us.to\/wordpress\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-09-10-1024x560.jpg 1024w, https:\/\/kuo.us.to\/wordpress\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-09-10-300x164.jpg 300w, https:\/\/kuo.us.to\/wordpress\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-09-10-768x420.jpg 768w, https:\/\/kuo.us.to\/wordpress\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-09-10.jpg 1213w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u9644\u4ef62-1_Word\u793a\u7bc4\u6587\u4ef6_\u6a6b_edited.docx\u7684\u9801\u5c3e\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"560\" src=\"https:\/\/kuo.us.to\/wordpress\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-09-10-1-1024x560.jpg\" alt=\"\" class=\"wp-image-886\" srcset=\"https:\/\/kuo.us.to\/wordpress\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-09-10-1-1024x560.jpg 1024w, https:\/\/kuo.us.to\/wordpress\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-09-10-1-300x164.jpg 300w, https:\/\/kuo.us.to\/wordpress\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-09-10-1-768x420.jpg 768w, https:\/\/kuo.us.to\/wordpress\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-09-10-1.jpg 1213w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u4e2d\u9593\u6709\u4e00\u6bb5mark\u6389\u7684\u7a0b\u5f0f\u78bc\u662f\u5148\u5224\u65b7\u6587\u4ef6\u662fA4\u76f4\u5f0f\u9084\u662fA4\u6a6b\u5f0f\uff0c<br>\u518d\u5c07\u9801\u9996\u7684\u9644\u4ef61-1\u653e\u5728\u5de6\u908a\uff0c\u4e5f\u653e\u5728\u53f3\u908a\uff0c\u8655\u7406\u7684\u7d50\u679c\u6703\u662f\u5982\u6b64\uff1a<\/p>\n\n\n\n<blockquote class=\"wp-block-quote\"><p>\u5982\u679c\u8981\u4f7f\u7528\uff0c\u5148\u5c07mytext = header\u7d66mark\u6389\u3002<\/p><p>\u9019\u4e00\u6bb5h_paragraph_format.alignment = WD_ALIGN_PARAGRAPH.RIGHT\u4e5f\u8981mark\u6389<\/p><\/blockquote>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"487\" src=\"https:\/\/kuo.us.to\/wordpress\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-09-11-1024x487.jpg\" alt=\"\" class=\"wp-image-887\" srcset=\"https:\/\/kuo.us.to\/wordpress\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-09-11-1024x487.jpg 1024w, https:\/\/kuo.us.to\/wordpress\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-09-11-300x143.jpg 300w, https:\/\/kuo.us.to\/wordpress\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-09-11-768x365.jpg 768w, https:\/\/kuo.us.to\/wordpress\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-09-11.jpg 1046w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"449\" src=\"https:\/\/kuo.us.to\/wordpress\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-09-12-1024x449.jpg\" alt=\"\" class=\"wp-image-888\" srcset=\"https:\/\/kuo.us.to\/wordpress\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-09-12-1024x449.jpg 1024w, https:\/\/kuo.us.to\/wordpress\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-09-12-300x132.jpg 300w, https:\/\/kuo.us.to\/wordpress\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-09-12-768x337.jpg 768w, https:\/\/kuo.us.to\/wordpress\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-09-12.jpg 1215w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u4ee5\u4e0a\u5c31\u662f\u9019\u6b21\u7684\u5206\u4eab!!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7814\u7a76\u4e86\u597d\u5e7e\u5929\uff0cword\u6279\u6b21\u589e\u52a0\u9801\u9996\u548c\u9801\u5c3e\u6709\u4e00\u4e9b\u5148\u5929\u4e0a\u7684\u9650\u5236!! python\u7684docx\u6a21\u7d44\u529f\u80fd\u5f88\u5f37\uff0c\u4f46\u9084\u662f\u6709\u90e8 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":870,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"advgb_blocks_editor_width":"","advgb_blocks_columns_visual_guide":"","site-sidebar-layout":"default","site-content-layout":"default","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"default","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}}},"categories":[4],"tags":[403,9,413,408,178,407],"author_meta":{"display_name":"mackuo","author_link":"https:\/\/kuo.us.to\/wordpress\/author\/mackuo\/"},"featured_img":"https:\/\/kuo.us.to\/wordpress\/wp-content\/uploads\/2023\/06\/gagoqmwvar4-300x200.jpg","coauthors":[],"tax_additional":{"categories":{"linked":["<a href=\"https:\/\/kuo.us.to\/wordpress\/category\/python%e5%ad%b8%e7%bf%92%e7%ad%86%e8%a8%98\/\" class=\"advgb-post-tax-term\">Python\u5b78\u7fd2\u7b46\u8a18<\/a>"],"unlinked":["<span class=\"advgb-post-tax-term\">Python\u5b78\u7fd2\u7b46\u8a18<\/span>"]},"tags":{"linked":["<a href=\"https:\/\/kuo.us.to\/wordpress\/category\/python%e5%ad%b8%e7%bf%92%e7%ad%86%e8%a8%98\/\" class=\"advgb-post-tax-term\">docx<\/a>","<a href=\"https:\/\/kuo.us.to\/wordpress\/category\/python%e5%ad%b8%e7%bf%92%e7%ad%86%e8%a8%98\/\" class=\"advgb-post-tax-term\">Python<\/a>","<a href=\"https:\/\/kuo.us.to\/wordpress\/category\/python%e5%ad%b8%e7%bf%92%e7%ad%86%e8%a8%98\/\" class=\"advgb-post-tax-term\">python-docx<\/a>","<a href=\"https:\/\/kuo.us.to\/wordpress\/category\/python%e5%ad%b8%e7%bf%92%e7%ad%86%e8%a8%98\/\" class=\"advgb-post-tax-term\">word<\/a>","<a href=\"https:\/\/kuo.us.to\/wordpress\/category\/python%e5%ad%b8%e7%bf%92%e7%ad%86%e8%a8%98\/\" class=\"advgb-post-tax-term\">\u6279\u6b21<\/a>","<a href=\"https:\/\/kuo.us.to\/wordpress\/category\/python%e5%ad%b8%e7%bf%92%e7%ad%86%e8%a8%98\/\" class=\"advgb-post-tax-term\">\u9801\u9996\u9801\u5c3e<\/a>"],"unlinked":["<span class=\"advgb-post-tax-term\">docx<\/span>","<span class=\"advgb-post-tax-term\">Python<\/span>","<span class=\"advgb-post-tax-term\">python-docx<\/span>","<span class=\"advgb-post-tax-term\">word<\/span>","<span class=\"advgb-post-tax-term\">\u6279\u6b21<\/span>","<span class=\"advgb-post-tax-term\">\u9801\u9996\u9801\u5c3e<\/span>"]}},"comment_count":"0","relative_dates":{"created":"Posted 3 \u5e74 ago","modified":"Updated 3 \u5e74 ago"},"absolute_dates":{"created":"Posted on 2023 \u5e74 6 \u6708 9 \u65e5","modified":"Updated on 2023 \u5e74 6 \u6708 9 \u65e5"},"absolute_dates_time":{"created":"Posted on 2023 \u5e74 6 \u6708 9 \u65e5 \u4e0b\u5348 4:17","modified":"Updated on 2023 \u5e74 6 \u6708 9 \u65e5 \u4e0b\u5348 4:58"},"featured_img_caption":"","series_order":"","_links":{"self":[{"href":"https:\/\/kuo.us.to\/wordpress\/wp-json\/wp\/v2\/posts\/869"}],"collection":[{"href":"https:\/\/kuo.us.to\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kuo.us.to\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kuo.us.to\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kuo.us.to\/wordpress\/wp-json\/wp\/v2\/comments?post=869"}],"version-history":[{"count":3,"href":"https:\/\/kuo.us.to\/wordpress\/wp-json\/wp\/v2\/posts\/869\/revisions"}],"predecessor-version":[{"id":889,"href":"https:\/\/kuo.us.to\/wordpress\/wp-json\/wp\/v2\/posts\/869\/revisions\/889"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kuo.us.to\/wordpress\/wp-json\/wp\/v2\/media\/870"}],"wp:attachment":[{"href":"https:\/\/kuo.us.to\/wordpress\/wp-json\/wp\/v2\/media?parent=869"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kuo.us.to\/wordpress\/wp-json\/wp\/v2\/categories?post=869"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kuo.us.to\/wordpress\/wp-json\/wp\/v2\/tags?post=869"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}