Codeunit "Edit in Excel Workbook"
This codeunit provides an interface to create workbooks using the Excel Add-in.
Properties
| Name | Value |
|---|---|
| Access | Public |
Methods
Initialize
Initialize the workbook. This will setup all required information for the add-in.
procedure Initialize(ServiceName: Text[250])
Parameters
| Name | Type | Description |
|---|---|---|
| ServiceName | Text[250] |
The name of the service the Excel add-in should connect to. This service must exist and be published. |
SetFilters
Sets the filters in the Excel Add-in.
procedure SetFilters(EditInExcelFilters: Codeunit "Edit in Excel Filters")
Parameters
| Name | Type | Description |
|---|---|---|
| EditInExcelFilters | Codeunit System.Integration.Excel."Edit in Excel Filters" |
Filters to be applied. |
SetSearchText
Set the search text of the Excel Add-in. This works similar to searching on a page for the specified text.
procedure SetSearchText(SearchText: Text)
Parameters
| Name | Type | Description |
|---|---|---|
| SearchText | Text |
The text that should be searched for. |
AddColumn
Add the specified OdataField with the given caption to the Excel file.
procedure AddColumn(Caption: Text, OdataFieldName: Text)
Parameters
| Name | Type | Description |
|---|---|---|
| Caption | Text |
Caption of the field. |
| OdataFieldName | Text |
Caption of the field. |
InsertColumn
Add the specified OdataField with the given caption to the Excel file at the specified location.
procedure InsertColumn(Index: Integer, Caption: Text, OdataFieldName: Text)
Parameters
| Name | Type | Description |
|---|---|---|
| Index | Integer |
Location to insert. |
| Caption | Text |
Caption of the field. |
| OdataFieldName | Text |
Location to insert. |
ImposeExcelOnlineRestrictions
When the Excel file is opened in Excel online, there are certain restrictions such as a column limit. This will trim additional columns and impose any future restrictions.
procedure ImposeExcelOnlineRestrictions()
ExportToStream
Generate an Excel file and create an InStream with the content.
procedure ExportToStream(): InStream
Returns
| Type | Description |
|---|---|
| InStream |
An InStream containing the generated Excel file. |