diff --git a/Document-Processing/ai-agent-tools/example-prompts.md b/Document-Processing/ai-agent-tools/example-prompts.md index 890c55aa8..9bd2472ff 100644 --- a/Document-Processing/ai-agent-tools/example-prompts.md +++ b/Document-Processing/ai-agent-tools/example-prompts.md @@ -46,10 +46,10 @@ Load the employee Onboarding letter template 'Onboarding_template.docx' from {In Load the legal service agreement template 'service_agreement_template.docx' from {InputDir}. Replace the placeholder '[CLIENT_NAME]' with 'Apex Innovations Ltd.', '[SERVICE_FEE]' with '$18,500', and '[CONTRACT_DATE]' with 'April 1, 2026'. Additionally, use a regex pattern to find all date placeholders matching the pattern '\[DATE_[A-Z]+\]' and replace them with 'TBD'. Return the total count of all replacements made. Export the finalized agreement as 'service_agreement_apex.docx' to {OutputDir}. {% endpromptcard %} {% promptcard ImportMarkdown %} -Our developer wrote the API release notes in Markdown format - load the file 'release_notes_v3.2.mdx' from {InputDir}, import it into a new Word document to convert it into a properly formatted .docx file suitable for distribution to non-technical stakeholders. Export the document as 'release_notes_v3.2.docx' to {OutputDir}. +Our developer wrote the API release notes in Markdown format - load the file 'release_notes_v3.2.md' from {InputDir}, import it into a new Word document to convert it into a properly formatted .docx file suitable for distribution to non-technical stakeholders. Export the document as 'release_notes_v3.2.docx' to {OutputDir}. {% endpromptcard %} {% promptcard GetFormData, SetFormFields %} -Load the patient intake form 'patient_intake_form.docx' from {InputDir}. First, read all current form field values to see what fields are available. Then set the form with the following patient information: PatientName='Robert Hayes', DateOfBirth='03/12/1978', Gender='Male', ContactNumber='+1 (214) 555-7834', EmailAddress='Robert.Hayes@example.com', Address='4567 Elm Street, Apt 210, Dallas, TX 75201, United States', InsuranceProvider='Blue Cross Blue Shield', InsuranceID='INS-4892-XY', InsuranceGroupNumber='GRP-10293', Diabetes = "true", EmergencyContact='Laura Hayes', EmergencyRelation='Spouse', EmergencyPhone='+1 (214) 555-4466', Declaration = 'true', PatientSignature='Robert Hayes', FormDate='04/02/2026'. Export the completed form as 'Intake_Form_Robert_Hayes.docx' to {OutputDir}. +Load the patient intake form 'patient_intake_form.docx' from {InputDir}. First, read all current form field values to see what fields are available. Then set the form with the following patient information: PatientName='Robert Hayes', DateOfBirth='03/12/1978', Gender='Male', ContactNumber='+1 (214) 555-7834', EmailAddress='robert.hayes@example.com', Address='4567 Elm Street, Apt 210, Dallas, TX 75201, United States', InsuranceProvider='Blue Cross Blue Shield', InsuranceID='INS-4892-XY', InsuranceGroupNumber='GRP-10293', Diabetes = "true", EmergencyContact='Laura Hayes', EmergencyRelation='Spouse', EmergencyPhone='+1 (214) 555-4466', Declaration = 'true', PatientSignature='Robert Hayes', FormDate='04/02/2026'. Export the completed form as 'Intake_Form_Robert_Hayes.docx' to {OutputDir}. {% endpromptcard %} {% promptcard GetBookmarks, SplitDocument %} Load the comprehensive legal contract bundle 'master_contracts_2026.docx' from {InputDir}. List all bookmarks in the document to identify the section boundaries. Split the document by bookmarks so that each bookmarked region - such as 'VendorAgreement', 'NDASection', and 'SLATerms' - becomes a standalone contract file. Export each split document to {OutputDir}. @@ -63,7 +63,7 @@ Load the comprehensive legal contract bundle 'master_contracts_2026.docx' from { Load a sales performance dashboard workbook ‘sales_dashboard_Q1_2026.xlsx’ from {InputDir}. Add a worksheet named ‘DataValidation’ and create the List validation in the A1:B3 range and the list names "Excel", "Presentation", "Word", "PDF". Then create a clustered bar chart from the ‘Sales data’ sheet data range A1:D5, positioning it in rows 8–23 and columns 1–8. Set the chart title to ‘Q1 2026 Regional Sales Performance’, set the category axis title to ‘Region’, and the value axis title to ‘Revenue (USD)’. Enable the chart legend at the bottom. Export the workbook to {OutputDir}. {% endpromptcard %} {% promptcard AddConditionalFormat %} -Load an inventory management workbook ‘inventory_status.xlsx’ from {InputDir}. Get the "Stock_Levels" sheet and apply conditional formatting to the In_Stock column (D2:D11): highlight cells in red where the value is less than the reorder threshold (use 10 as the formula threshold for the conditional format). Export the workbook to {OutputDir}. +Load an inventory management workbook ‘inventory_status.xlsx’ from {InputDir}. Get the "Stock_Levels" sheet and apply conditional formatting to the Reorder_point column (D2:D11): highlight cells in red where the value is less than the reorder threshold (use 10 as the formula threshold for the conditional format). Export the workbook to {OutputDir}. {% endpromptcard %} {% promptcard ProtectWorksheet, ProtectWorkbook %} Load a confidential board-level financial model workbook ‘board_financial_model_2026.xlsx’ from {InputDir}. Protect the Assumptions and Projections worksheets with the password ‘ModelLock@2026’ to prevent unauthorized edits to the model logic. Protect the overall workbook structure with the password ‘Board@2026’ to prevent adding or deleting sheets. Export the workbook to {OutputDir}. @@ -114,10 +114,10 @@ Convert the sales conference presentation 'sales_conference_2026.pptx' from {Inp {% promptcards %} {% promptcard ExtractDataAsJSON %} -Extract all structured data from the vendor invoice 'invoice_APR2026_00142.pdf' located at {InputDir}. Enable both form and table detection to capture invoice header fields (vendor name, invoice number, date, due date) and the line-item table (description, quantity, unit price, total). Use a confidence threshold of 0.7 for reliable results. Save the extracted JSON to 'invoice_APR2026_00142_data.json' in {OutputDir}. +Extract all structured data from the PDF document ‘conversion_demo.pdf’ located at {InputDir}. Enable both form and table detection . Use a confidence threshold of 0.6 for reliable results. Save the extracted JSON to ‘conversion_demo_data.json’ in {OutputDir}. {% endpromptcard %} {% promptcard ExtractTableAsJSON %} -Extract only the table data from the quarterly financial report 'financial_report_Q1_2026.pdf' located at {InputDir}. The report contains multiple financial tables across 15 pages - enable border less table detection to ensure all tables are captured even if they lack visible borders. Use a confidence threshold of 0.3. Save the extracted table data as 'financial_tables_Q1_2026.json' in {OutputDir}. +Extract only the table data from the quarterly financial report ‘table_conversion_demo.pdf’ located at {InputDir}. Enable border less table detection to ensure all tables are captured even if they lack visible borders. Use a confidence threshold of 0.3. Save the extracted table data as ‘table_conversion_demo.json’ in {OutputDir}. {% endpromptcard %} {% endpromptcards %} diff --git a/Document-Processing/ai-agent-tools/getting-started-storage-mode.md b/Document-Processing/ai-agent-tools/getting-started-storage-mode.md index 22326c2d0..1b29d807e 100644 --- a/Document-Processing/ai-agent-tools/getting-started-storage-mode.md +++ b/Document-Processing/ai-agent-tools/getting-started-storage-mode.md @@ -11,11 +11,11 @@ documentation: ug This guide covers each integration step-from registering a Syncfusion license and implementing document storage to converting tools into Microsoft.Extensions.AI functions and building a fully interactive agent. The example uses the Microsoft Agents Framework with OpenAI, but the same steps apply to any [provider](https://learn.microsoft.com/en-us/agent-framework/agents/providers/?pivots=programming-language-csharp) that implements `IChatClient`. -In this guide, we demonstrate how to configure **Azure Blob Storage** as the document storage provider, but the same pattern works with any storage back end (AWS S3, local disk, etc.) by implementing the `IDocumentStorage` interface. +In this guide, we demonstrate how to configure **Azure Blob Storage** as the document storage provider, but the same pattern works with any storage backend (AWS S3, local disk, etc.) by implementing the `IDocumentStorage` interface. ## Overview -Documents are read from and written to storage (Azure Blob, S3, local disk, etc.) on each tool invocation. No in-memory objects are maintained between tool calls-each operation opens the document from storage, processes it, and saves it back. This mode is ideal for distributed systems, server less architectures, and scenarios where document persistence is required. +Documents are read from and written to storage (Azure Blob, S3, local disk, etc.) on each tool invocation. No in-memory objects are maintained between tool calls-each operation opens the document from storage, processes it, and saves it back. This mode is ideal for distributed systems, serverless architectures, and scenarios where document persistence is required. ## Prerequisites @@ -225,6 +225,7 @@ private static string BuildSystemMessage(string inputDir, string outputDir) => $ 2. **WAIT FOR RESULTS**: After each tool call, WAIT for the result before the next action. 3. **CHAIN OUTPUTS**: Use the output file path from the previous tool as input for the next tool. Break down multi-step operations: Call tool → wait → use result as input → call next tool → repeat. + 4. **CONSISTENT OUTPUT NAMING**: Use one identical output file name for all tool calls. **CROSS-FORMAT CONVERSION:** For Office-to-PDF: Use ConvertToPDF with sourceFilePath and sourceType (""Word"", ""Excel"", ""PowerPoint""). diff --git a/Document-Processing/ai-agent-tools/getting-started.md b/Document-Processing/ai-agent-tools/getting-started.md index f393d50b5..4201a6c17 100644 --- a/Document-Processing/ai-agent-tools/getting-started.md +++ b/Document-Processing/ai-agent-tools/getting-started.md @@ -50,8 +50,6 @@ The Microsoft Agent Framework supports the following providers for .NET: - **[Azure OpenAI](https://learn.microsoft.com/en-us/agent-framework/agents/providers/azure-openai)** - **[OpenAI](https://learn.microsoft.com/en-us/agent-framework/agents/providers/openai)** -- **[Anthropic](https://learn.microsoft.com/en-us/agent-framework/agents/providers/anthropic)** -- **[Microsoft Foundry](https://learn.microsoft.com/en-us/agent-framework/agents/providers/microsoft-foundry)** For more details, see the [Microsoft Agent Framework Providers documentation](https://learn.microsoft.com/en-us/agent-framework/agents/providers/?pivots=programming-language-csharp). diff --git a/Document-Processing/ai-agent-tools/overview.md b/Document-Processing/ai-agent-tools/overview.md index c9bd2ad50..7b64affc9 100644 --- a/Document-Processing/ai-agent-tools/overview.md +++ b/Document-Processing/ai-agent-tools/overview.md @@ -9,16 +9,18 @@ documentation: ug # Syncfusion Document SDK AI Agent Tools Overview -**[Syncfusion Document SDK AI Agent Tool](https://www.nuget.org/packages/Syncfusion.DocIO.Net.Core)** is a comprehensive AI toolkit that enables AI models and assistants to autonomously create, manipulate, convert, and extract data from documents using Syncfusion Document SDK libraries. +**[Syncfusion Document SDK AI Agent Tool](https://www.nuget.org/packages/Syncfusion.DocIO.Net.Core)** is a .NET library offering comprehensive AI toolkit that enables AI models and assistants to autonomously create, manipulate, convert, and extract data from Word, Excel, PDF, PowerPoint, Markdown, HTML, and RTF documents using [Syncfusion Document SDK](https://www.syncfusion.com/document-sdk) libraries. -It exposes a rich set of well-defined tools and functions that an [AI agent](https://learn.microsoft.com/en-us/agent-framework/get-started/your-first-agent?pivots=programming-language-csharp) can invoke to perform document operations across Word, Excel, PDF, PowerPoint, HTML and Markdown formats - without requiring the host application to implement document-processing logic directly. +It exposes a rich set of pre-defined tools and functions that an [AI agent](https://learn.microsoft.com/en-us/agent-framework/get-started/your-first-agent?pivots=programming-language-csharp) can invoke to perform document operations across various file formats - without requiring the host application to implement document-processing logic directly. + +You can quickly deploy it to your infrastructure via [NuGet](https://www.nuget.org/packages/Syncfusion.DocIO.Net.Core). If you want to add new functionality or customize any existing functionalities, then you can use our source code available on [GitHub](https://github.com/SyncfusionExamples/DocIO-Examples/tree/main). ## Key Capabilities ### PDF -The PDF tools cover the full document life cycle - from creating and loading PDFs to securing, extracting content, and converting formats. Whether you need to merge invoices, redact sensitive data, add digital signatures, or run OCR on scanned pages, these tools handle it autonomously. +The PDF tools cover the full document lifecycle - from creating and loading PDFs to securing, extracting content, and converting formats. Whether you need to merge invoices, redact sensitive data, add digital signatures, or run OCR on scanned pages, these tools handle it autonomously. - **Digital Signing** - Digitally sign PDF documents using a PFX certificate with configurable signature bounds and an optional visible appearance image. - **Redaction** - Permanently redact rectangular regions from PDF pages to remove sensitive content, with configurable fill color. @@ -48,7 +50,7 @@ The Word tools enable end-to-end document automation - from loading and editing - **Comparison** - Compare an original document with a revised version and mark all differences as tracked changes. - **Track Changes** - Accept or reject tracked revisions in a Word document, either by a specific author or all at once. - **Import/Export (HTML, Markdown)** - Import HTML or Markdown content into a Word document, or export document content as HTML, Markdown, or plain text. -- **Conversion to PDF, Image, RTF, and HTML** - Convert Word documents to PDF, export pages as PNG or JPEG images, or save in RTF, HTML, Doc, and TXT formats. +- **Conversion to PDF, Image, RTF, and HTML** - Convert Word documents to PDF, export pages as PNG or JPEG images, or save in RTF, HTML, Doc, and TXT formats and vice-versa. - **Field Management** - Update all document fields (DATE, TIME, IF, SEQ, etc.) or unlink them by replacing each field with its current static result. - **Table of Contents** - Rebuild the Table of Contents based on current heading styles and page layout. - **Document Security** - Protect, encrypt, unprotect, and decrypt Word documents with password-based security. @@ -56,7 +58,7 @@ The Word tools enable end-to-end document automation - from loading and editing ### Excel -The Excel tools let your agent create and manipulate workbooks programmatically - from setting cell values and formulas to building charts, pivot tables, and conditional formatting rules. They also support workbook security, data validation, and conversion to image, HTML, and JSON formats. +The Excel tools let your agent create and manipulate workbooks programmatically - from setting cell values and formulas to building charts, pivot tables, and conditional formatting rules. They also support workbook security, data validation, and conversion to image, CSV, HTML, and JSON formats. - **Charts** - Create charts from data ranges, add named series with values and category labels, and configure chart elements like titles, legends, data labels, and axis titles. Supports many chart types, including Column, Line, Pie, and Bar. - **Conditional Formatting** - Add conditional formatting to cells or ranges using cell value rules, formulas, data bars, color scales, or icon sets with customizable styles. @@ -64,7 +66,7 @@ The Excel tools let your agent create and manipulate workbooks programmatically - **Pivot Tables** - Create pivot tables from data ranges with row, column, and data fields. Supports aggregation functions like Sum, Count, Average, Max, and Min, along with built-in styles. - **Encryption & Protection** - Encrypt and decrypt workbooks with passwords. Protect or unprotect workbook structure and individual worksheets. - **Worksheet Management** - Create, delete, and manage worksheets within Excel workbooks. -- **Conversion to Image, HTML, and JSON** - Convert worksheets or charts to PNG and JPEG images. Export workbooks or worksheets to HTML with preserved styles, or to JSON with optional schema. Convert specific cell ranges to JSON. +- **Conversion to Image, CSV, HTML, and JSON** - Convert worksheets or charts to PNG and JPEG images. Export workbooks or worksheets to HTML with preserved styles, or to JSON with optional schema. Convert specific cell ranges to JSON. - **Workbook Format Conversion** - Convert workbooks between XLS, XLSX, XLSM, and CSV formats. ### PowerPoint @@ -84,19 +86,21 @@ The Office to PDF tool bridges Word, Excel, and PowerPoint with the PDF format. - **Office to PDF Conversion** - Convert Word, Excel, or PowerPoint documents to PDF in a single tool call by specifying the source document and its type. -### Smart Data Extraction +### Data Extraction The data extraction tools used to pull structured information from PDFs and images. They can identify text, tables, form fields, checkboxes, signatures, and radio buttons, returning results as clean JSON for downstream processing. - **Structured Data Extraction** - Extract structured data including text, forms, tables, checkboxes, signatures, and radio buttons from PDF or image files and return the result as JSON. - **Table Extraction** - Extract only table data from PDF documents as JSON, optimized for table-focused extraction with support for border less tables. - **Form Recognition** - Extract only form field data from PDF documents as JSON, optimized for form-focused recognition with support for signatures, textboxes, checkboxes, and radio buttons. +- **PDF to Markdown Conversion** - Convert PDF documents and scanned images into structured Markdown (MD) by extracting text, tables, headers, and form fields, with configurable detection and layout preservation. +- **PDF Table to Markdown Conversion** - Convert tables from PDF documents and scanned images into clean and well‑structured Markdown (MD) format by analyzing visual table structures, including bordered and border‑less tables, for accurate programmatic table extraction. ## Supported Document Formats | Format | Supported File Types | |---|---| -| **Word** | `.docx`, `.doc`, `.rtf`, `.html`, `.txt` | +| **Word** | `.docx`, `.doc`, `.rtf`, `.html`, `.txt`, `.md` | | **Excel** | `.xlsx`, `.xls`, `.xlsm`, `.csv` | | **PDF** | `.pdf` | | **PowerPoint** | `.pptx` | diff --git a/Document-Processing/ai-agent-tools/tools.md b/Document-Processing/ai-agent-tools/tools.md index 89441825b..4c9156769 100644 --- a/Document-Processing/ai-agent-tools/tools.md +++ b/Document-Processing/ai-agent-tools/tools.md @@ -26,7 +26,7 @@ Tools are organized into the following categories: | **Word** | WordDocumentAgentTools,
WordOperationsAgentTools,
WordSecurityAgentTools,
WordMailMergeAgentTools,
WordFindAndReplaceAgentTools,
WordRevisionAgentTools,
WordImportExportAgentTools,
WordFormFieldAgentTools,
WordBookmarkAgentTools | | **Excel** | ExcelWorkbookAgentTools,
ExcelWorksheetAgentTools,
ExcelSecurityAgentTools,
ExcelFormulaAgentTools,
ExcelChartAgentTools,
ExcelConditionalFormattingAgentTools,
ExcelConversionAgentTools,
ExcelDataValidationAgentTools,
ExcelPivotTableAgentTools | | **PowerPoint** | PresentationDocumentAgentTools,
PresentationOperationsAgentTools,
PresentationSecurityAgentTools,
PresentationContentAgentTools,
PresentationFindAndReplaceAgentTools | -| **Conversion** | OfficeToPdfAgentTools | Convert Word, Excel, and PowerPoint documents to PDF. | +| **Conversion** | OfficeToPdfAgentTools | | **Data Extraction** | DataExtractionAgentTools | @@ -355,7 +355,7 @@ Provides tools to create, edit pivot table in workbook | Tool | Syntax | Description | |---|---|---| -| CreatePivotTable | CreatePivotTable(
string workbookIdOrFilePath,
string dataWorksheetName,
string dataRange,
string pivotWorksheetName,
string pivotTableName,
string pivotLocation,
string rowFieldIndices,
string columnFieldIndices,
int dataFieldIndex,
string dataFieldCaption,
string builtInStyle = "None",
string subtotalType = "Sum",
string? outputFilePath = null) | Creates a pivot table in the specified worksheet using a data range from a source worksheet. Supports row, column, and data (values) fields with a chosen aggregation function. `builtInStyle` options: `PivotStyleLight1-28`, `PivotStyleMedium1-28`, `PivotStyleDark1-28`, or `None`. `subtotalType` options: `Sum`, `Count`, `Average`, `Max`, `Min`, `Product`, `CountNumbs`, `StdDev`, `StdDevP`, `Var`, `VarP`. Only supported in XLSX format. | +| CreatePivotTable | CreatePivotTable(
string workbookIdOrFilePath,
string dataWorksheetName,
string dataRange,
string pivotWorksheetName,
string pivotTableName,
string pivotLocation,
string rowFieldIndices,
string columnFieldIndices,
int dataFieldIndex,
string dataFieldCaption,
string builtInStyle = "None",
string subtotalType = "Sum",
string? outputFilePath = null) | Creates a pivot table in the specified worksheet using a data range from a source worksheet. Supports row, column, and data (values) fields with a chosen aggregation function. `builtInStyle` options: `PivotStyleLight1-28`, `PivotStyleMedium1-28`, `PivotStyleDark1-28`, or `None`. `subtotalType` options: `Sum`, `Count`, `Average`, `Max`, `Min`, `Product`, `CountNums`, `StdDev`, `StdDevP`, `Var`, `VarP`. Only supported in XLSX format. | ## PowerPoint Tools @@ -439,6 +439,8 @@ Provides AI-powered structured data extraction from PDF documents and images, re | ExtractDataAsJSON | ExtractDataAsJSON(
string inputFilePath,
bool enableFormDetection = true,
bool enableTableDetection = true,
double confidenceThreshold = 0.6,
int startPage = -1,
int endPage = -1,
bool detectSignatures = true,
bool detectTextboxes = true,
bool detectCheckboxes = true,
bool detectRadioButtons = true,
bool detect_Border_less_Tables = true,
string? outputFilePath = null) | Extracts structured data (text, forms, tables, checkboxes, signatures) from a PDF or image file and returns the result as JSON. | | ExtractTableAsJSON | ExtractTableAsJSON(
string inputFilePath,
bool detect_Border_less_Tables = true,
double confidenceThreshold = 0.6,
int startPage = -1,
int endPage = -1,
string? outputFilePath = null) | Extracts only table data from a PDF document and returns the result as JSON. Optimized for table-focused extraction. | | RecognizeFormAsJson | RecognizeFormAsJson(
string inputFilePath,
bool detectSignatures = true,
bool detectTextboxes = true,
bool detectCheckboxes = true,
bool detectRadioButtons = true,
double confidenceThreshold = 0.6,
int startPage = -1,
int endPage = -1,
string? outputFilePath = null) | Extracts only form field data from a PDF document and returns as JSON. Optimized for form-focused recognition. | +| ConvertPDFtoMarkdown | ConvertPDFtoMarkdown(
string inputFilePath,
bool enableFormDetection = true,
bool enableTableDetection = true,
double confidenceThreshold = 0.6,
int startPage = -1,
int endPage = -1,
bool detectSignatures = true,
bool detectTextboxes = true,
bool detectCheckboxes = true,
bool detectRadioButtons = true,
bool detectBorderlessTables = true,
string? outputFilePath = null) | Convert PDF documents and scanned images into structured Markdown (MD) by extracting text, tables, headers, and form fields, with configurable detection and layout preservation. | +| ConvertPDFTableToMarkdown | ConvertPDFTableToMarkdown(
string inputFilePath,
double confidenceThreshold = 0.6,
int startPage = -1,
int endPage = -1,
bool detectBorderlessTables = true,
string? outputFilePath = null) | Convert tables from PDF documents and scanned images into clean and well‑structured Markdown (MD) format by analyzing visual table structures, including bordered and border‑less tables, for accurate programmatic table extraction. |