#!/usr/bin/env python3
"""
Simple example script showing how to use ActionItemLinker programmatically
"""

from link_excel_to_word import ActionItemLinker

# Example 1: Just read and display an action item
print("Example 1: Reading Action Item 003")
print("=" * 60)

linker = ActionItemLinker("actions.xlsx")  # Replace with your Excel file path
linker.load_excel()

action_data = linker.find_action_by_no("003")
for key, value in action_data.items():
    if value:
        print(f"{key}: {value}")

print("\n" + "=" * 60)

# Example 2: Insert into Word document
print("\nExample 2: Inserting into Word Document")
print("=" * 60)

linker.word_path = "minutes.docx"  # Replace with your Word file path

# Insert only selected fields
selected_fields = ["Action Short Title", "Who", "Status", "Priority"]
doc = linker.insert_into_word(
    action_data,
    fields=selected_fields,
    placeholder="<<ACTION_003>>"
)
doc.save("minutes_updated.docx")
print("Word document saved as 'minutes_updated.docx'")

# Example 3: Insert as formatted table
print("\nExample 3: Inserting as Formatted Table")
print("=" * 60)

doc = linker.insert_table_into_word(
    action_data,
    fields=["Action Short Title", "Who", "Status", "Priority", "Next Action Deadline"],
    placeholder="<<ACTION_003_TABLE>>"
)
doc.save("minutes_with_table.docx")
print("Word document with table saved as 'minutes_with_table.docx'")





