code: def convert_info_docx(img, res, save_folder, img_name):
      doc = Document()
      doc.styles["Normal"].font.name = "Times New Roman"
      doc.styles["Normal"]._element.rPr.rFonts.set(
          qn("w:eastAsia"), "宋体"
      )
      doc.styles["Normal"].font.size = shared.Pt(6.5)
  
      flag = 1
      for i, region in enumerate(res):
          if len(region["res"]) == 0:
              continue
          img_idx = region["img_idx"]
          if flag == 2 and region["layout"] == "single":
              section = doc.add_section(WD_SECTION.CONTINUOUS)
              section._sectPr.xpath("./w:cols")[0].set(qn("w:num"), "1")
              flag = 1
          elif flag == 1 and region["layout"] == "double":
              section = doc.add_section(WD_SECTION.CONTINUOUS)
              section._sectPr.xpath("./w:cols")[0].set(qn("w:num"), "2")
              flag = 2
  
          if region["type"].lower() == "figure":
              excel_save_folder = os.path.join(save_folder, img_name)
              img_path = os.path.join(
                  excel_save_folder,
                  "{}_{}.jpg".format(region["bbox"], img_idx),
              )
              paragraph_pic = doc.add_paragraph()
              paragraph_pic.alignment = WD_ALIGN_PARAGRAPH.CENTER
              run = paragraph_pic.add_run("")
              if flag == 1:
                  run.add_picture(img_path, width=shared.Inches(5))
              elif flag == 2:
                  run.add_picture(img_path, width=shared.Inches(2))
          elif region["type"].lower() == "title":
              doc.add_heading(region["res"][0]["text"])
          elif region["type"].lower() == "table":
              parser = HtmlToDocx()
              parser.table_style = "TableGrid"
              parser.handle_table(region["res"]["html"], doc)
          else:
              paragraph = doc.add_paragraph()
              paragraph_format = paragraph.paragraph_format
              for i, line in enumerate(region["res"]):
                  if i == 0:
                      paragraph_format.first_line_indent = (
                          shared.Inches(0.25)
                      )
                  text_run = paragraph.add_run(line["text"] + " ")
                  text_run.font.size = shared.Pt(10)
  
      # save to docx
      docx_path = os.path.join(
          save_folder, "{}_ocr.docx".format(img_name)
      )
      doc.save(docx_path)
      logger.info("docx save to {}".format(docx_path))
  
file_path: PaddleOCR/ppstructure/recovery/recovery_to_doc.py
imports: import os
  from copy import deepcopy
  from docx import Document
  from docx import shared
  from docx.enum.text import WD_ALIGN_PARAGRAPH
  from docx.enum.section import WD_SECTION
  from docx.oxml.ns import qn
  from docx.enum.table import WD_TABLE_ALIGNMENT
  from ppstructure.recovery.table_process import HtmlToDocx
  from ppocr.utils.logging import get_logger
label_desc: Use image node_id 1 for calling a global function with example usage: convert_info_docx(img, res, save_folder, img_name) without return types