ExcelWorkbookManager Class
Manager for handling Excel workbooks in memory during AI agent operations. Provides workbook lifecycle management with automatic cleanup.
Inherited Members
Namespace: Syncfusion.AI.AgentTools.Excel
Assembly: Syncfusion.DocumentSDK.AI.AgentTools.dll
Syntax
public class ExcelWorkbookManager : DocumentManagerBase<IWorkbook>, IDocumentManager, IDisposable
Constructors
ExcelWorkbookManager(Nullable<TimeSpan>)
Initializes a new instance of the ExcelWorkbookManager class.
Declaration
public ExcelWorkbookManager(Nullable<TimeSpan> expirationTime = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Nullable<System.TimeSpan> | expirationTime | Time before workbooks are automatically cleaned up. Default is 30 minutes. |
Properties
ActiveWorkbookId
Gets or sets the currently active workbook ID.
Declaration
public string ActiveWorkbookId { get; set; }
Property Value
| Type |
|---|
| System.String |
DocumentIdPrefix
Gets the prefix used for generating unique workbook identifiers.
Declaration
protected override string DocumentIdPrefix { get; }
Property Value
| Type | Description |
|---|---|
| System.String | The prefix string "xl_" used for Excel workbook IDs. |
Overrides
DocumentType
Gets the document type managed by this manager.
Declaration
public override DocumentType DocumentType { get; }
Property Value
| Type | Description |
|---|---|
| DocumentType | DocumentType.Excel indicating this manager handles Excel workbooks. |
Overrides
Methods
CloseDocument(IWorkbook)
Closes and releases the resources associated with the Excel workbook.
Declaration
protected override void CloseDocument(IWorkbook document)
Parameters
| Type | Name | Description |
|---|---|---|
| IWorkbook | document | The IWorkbook instance to close. |
Overrides
CreateDocumentInstance()
Creates a new empty Excel workbook instance.
Declaration
protected override IWorkbook CreateDocumentInstance()
Returns
| Type | Description |
|---|---|
| IWorkbook | A new IWorkbook instance ready for editing. |
Overrides
Dispose()
Disposes the Excel engine and all managed workbooks.
Declaration
public void Dispose()
ExportDocumentInstance(IWorkbook, String)
Exports the Excel workbook to the specified file path.
Declaration
protected override void ExportDocumentInstance(IWorkbook document, string filePath)
Parameters
| Type | Name | Description |
|---|---|---|
| IWorkbook | document | The IWorkbook instance to export. |
| System.String | filePath | The file path where the workbook will be saved. CSV format is supported with .csv extension. |
Overrides
ImportDocumentInstance(String)
Imports an existing Excel workbook from the specified file path.
Declaration
protected override IWorkbook ImportDocumentInstance(string filePath)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | filePath | The file path to the Excel workbook to load. |
Returns
| Type | Description |
|---|---|
| IWorkbook | An IWorkbook instance loaded from the specified file. |
Overrides
ImportDocumentInstance(String, String)
Imports an encrypted Excel workbook from the specified file path using the provided password.
Declaration
protected override IWorkbook ImportDocumentInstance(string filePath, string password)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | filePath | The file path to the encrypted Excel workbook. |
| System.String | password | The password required to open the encrypted workbook. |
Returns
| Type | Description |
|---|---|
| IWorkbook | An IWorkbook instance loaded from the specified file with decryption applied. |