alexa
menu

Document Processing

    Show / Hide Table of Contents

    WordFormFieldAgentTools Class

    Provides agent tools for managing form fields in Word documents. Handles form field data extraction, updates, and individual field operations.

    Inheritance
    System.Object
    AgentToolBase
    AgentToolBase<WordDocument>
    WordFormFieldAgentTools
    Inherited Members
    AgentToolBase<WordDocument>.InMemoryManager
    AgentToolBase<WordDocument>.Mode
    AgentToolBase<WordDocument>.OpenDocument(String, String)
    AgentToolBase<WordDocument>.SaveDocument(String, WordDocument)
    AgentToolBase<WordDocument>.SaveFile(String, Stream)
    AgentToolBase<WordDocument>.StorageManager
    AgentToolBase.GetTools()
    Namespace: Syncfusion.AI.AgentTools.Word
    Assembly: Syncfusion.DocumentSDK.AI.AgentTools.dll
    Syntax
    public class WordFormFieldAgentTools : AgentToolBase<WordDocument>

    Constructors

    WordFormFieldAgentTools(DocumentStorageManager)

    Initializes a new instance of the WordFormFieldAgentTools class (Mode 2 — DocumentStorage).

    Declaration
    public WordFormFieldAgentTools(DocumentStorageManager manager)
    Parameters
    Type Name Description
    DocumentStorageManager manager

    The document storage manager.

    WordFormFieldAgentTools(WordDocumentManager)

    Initializes a new instance of the WordFormFieldAgentTools class (Mode 1 — InMemory).

    Declaration
    public WordFormFieldAgentTools(WordDocumentManager manager)
    Parameters
    Type Name Description
    WordDocumentManager manager

    The document manager for managing Word documents.

    Methods

    GetFormData(String)

    Retrieves all form field data as a dictionary.

    Declaration
    [Tool(Name = "GetFormData", Description = "Retrieves all form field data as a dictionary. documentIdOrFilePath: The document ID (InMemory mode) or input file path (DocumentStorage mode).")]
    public AgentToolResult GetFormData([ToolParameter(Description = "The document ID (InMemory mode) or input file path (DocumentStorage mode)")] string documentIdOrFilePath)
    Parameters
    Type Name Description
    System.String documentIdOrFilePath

    The document ID (InMemory mode) or input file path (DocumentStorage mode).

    Returns
    Type Description
    AgentToolResult

    Result containing a dictionary of form field names and their values.

    GetFormField(String, String)

    Gets a specific form field value by field name.

    Declaration
    [Tool(Name = "GetFormField", Description = "Gets a specific form field value by field name. documentIdOrFilePath: The document ID (InMemory mode) or input file path (DocumentStorage mode).")]
    public AgentToolResult GetFormField([ToolParameter(Description = "The document ID (InMemory mode) or input file path (DocumentStorage mode)")] string documentIdOrFilePath, [ToolParameter(Description = "The name of the form field")] string fieldName)
    Parameters
    Type Name Description
    System.String documentIdOrFilePath

    The document ID (InMemory mode) or input file path (DocumentStorage mode).

    System.String fieldName

    The name of the form field to retrieve.

    Returns
    Type Description
    AgentToolResult

    Result containing the value of the specified form field.

    SetFormFields(String, String, String)

    Sets one or more form field values using a JSON string. Always use this tool to set any form field values.

    Declaration
    [Tool(Name = "SetFormFields", Description = "The only tool for setting form field values. Pass ALL field name/value pairs as a single JSON object string and call this tool exactly ONCE. documentIdOrFilePath: The document ID (InMemory mode) or input file path (DocumentStorage mode). Example: '{\"TextField1\":\"Hello\",\"Check1\":true,\"DropDown1\":\"Option A\"}'")]
    public AgentToolResult SetFormFields([ToolParameter(Description = "The document ID (InMemory mode) or input file path (DocumentStorage mode)")] string documentIdOrFilePath, [ToolParameter(Description = "A JSON object string containing all field names and their values. Text fields accept strings, checkboxes accept true/false, drop-downs accept the item text or a zero-based index. Example: '{\"PatientName\":\"John\",\"Diabetes\":true,\"Gender\":\"Male\"}'")] string dataJson, [ToolParameter(Description = "Output file path for saving the result (DocumentStorage mode only).")] string outputFilePath = null)
    Parameters
    Type Name Description
    System.String documentIdOrFilePath

    The document ID (InMemory mode) or input file path (DocumentStorage mode).

    System.String dataJson

    A JSON object string containing all form field names and their corresponding values.

    System.String outputFilePath

    Output file path for saving the result (DocumentStorage mode only).

    Returns
    Type Description
    AgentToolResult

    Result indicating whether the form fields were updated successfully.

    Back to top Generated by DocFX
    Copyright © 2001 - 2026 Syncfusion Inc. All Rights Reserved