RSGISLib MS Office Tools

Word

rsgislib.tools.msofficetools.docx_replace_whole_doc(word_doc_file: str, replace_lut: Dict[str, str])

Replace values specified within the replace_lut found within all parts (body, header and footer), including tables, within a Word document.

Parameters:
  • word_doc_file – file path to .docx file.

  • replace_lut – dictionary with replacement values {“value to replace”: “with value”}.

rsgislib.tools.msofficetools.docx_replace_body_content(word_doc_file: str, replace_lut: Dict[str, str])

Replace values specified within the replace_lut body content of a word document.

Parameters:
  • word_doc_file – file path to .docx file.

  • replace_lut – dictionary with replacement values {“value to replace”: “with value”}.

rsgislib.tools.msofficetools.docx_replace_body_tables(word_doc_file: str, replace_lut: Dict[str, str])

Replace values specified within the replace_lut tables found within the body content of a word document.

Parameters:
  • word_doc_file – file path to .docx file.

  • replace_lut – dictionary with replacement values {“value to replace”: “with value”}.

rsgislib.tools.msofficetools.docx_replace_header_content(word_doc_file: str, replace_lut: Dict[str, str])

Replace values specified within the replace_lut found within the header of a word document.

Parameters:
  • word_doc_file – file path to .docx file.

  • replace_lut – dictionary with replacement values {“value to replace”: “with value”}.

rsgislib.tools.msofficetools.docx_replace_header_tables(word_doc_file: str, replace_lut: Dict[str, str])

Replace values specified within the replace_lut found within tables in the header of a word document.

Parameters:
  • word_doc_file – file path to .docx file.

  • replace_lut – dictionary with replacement values {“value to replace”: “with value”}.

Replace values specified within the replace_lut found within the footer of a word document.

Parameters:
  • word_doc_file – file path to .docx file.

  • replace_lut – dictionary with replacement values {“value to replace”: “with value”}.

Replace values specified within the replace_lut found within tables in the footer of a word document.

Parameters:
  • word_doc_file – file path to .docx file.

  • replace_lut – dictionary with replacement values {“value to replace”: “with value”}.