create_document | Create a new Word document with optional metadata. Args:
filename: Name of the document to create (with or without .docx extension)
title: Optional title for the document metadata
author: Optional author for the document metadata |
add_heading | Add a heading to a Word document. Args:
filename: Path to the Word document
text: Heading text
level: Heading level (1-9, where 1 is the highest level) |
add_paragraph | Add a paragraph to a Word document. Args:
filename: Path to the Word document
text: Paragraph text
style: Optional paragraph style name |
add_table | Add a table to a Word document. Args:
filename: Path to the Word document
rows: Number of rows in the table
cols: Number of columns in the table
data: Optional 2D array of data to fill the table |
add_picture | Add an image to a Word document. Args:
filename: Path to the Word document
image_path: Path to the image file
width: Optional width in inches (proportional scaling) |
get_document_info | Get information about a Word document. Args:
filename: Path to the Word document |
get_document_text | Extract all text from a Word document. Args:
filename: Path to the Word document |
get_document_outline | Get the structure of a Word document. Args:
filename: Path to the Word document |
list_available_documents | List all .docx files in the specified directory. Args:
directory: Directory to search for Word documents |
copy_document | Create a copy of a Word document. Args:
source_filename: Path to the source document
destination_filename: Optional path for the copy. If not provided, a default name will be generated. |
format_text | Format a specific range of text within a paragraph. Args:
filename: Path to the Word document
paragraph_index: Index of the paragraph (0-based)
start_pos: Start position within the paragraph text
end_pos: End position within the paragraph text
bold: Set text bold (True/False)
italic: Set text italic (True/False)
underline: Set text underlined (True/False)
color: Text color (e.g., 'red', 'blue', etc.)
font_size: Font size in points
font_name: Font name/family |
search_and_replace | Search for text and replace all occurrences. Args:
filename: Path to the Word document
find_text: Text to search for
replace_text: Text to replace with |
delete_paragraph | Delete a paragraph from a document. Args:
filename: Path to the Word document
paragraph_index: Index of the paragraph to delete (0-based) |
create_custom_style | Create a custom style in the document. Args:
filename: Path to the Word document
style_name: Name for the new style
bold: Set text bold (True/False)
italic: Set text italic (True/False)
font_size: Font size in points
font_name: Font name/family
color: Text color (e.g., 'red', 'blue')
base_style: Optional existing style to base this on |
format_table | Format a table with borders, shading, and structure. Args:
filename: Path to the Word document
table_index: Index of the table (0-based)
has_header_row: If True, formats the first row as a header
border_style: Style for borders ('none', 'single', 'double', 'thick')
shading: 2D list of cell background colors (by row and column) |
add_page_break | Add a page break to the document. Args:
filename: Path to the Word document |