Daniel's XL Toolbox NG
XLToolbox.Vba.Api Class Reference

Exposes some of the XL Toolbox features to external programs, such as VBA code. More...

Inheritance diagram for XLToolbox.Vba.Api:
Collaboration diagram for XLToolbox.Vba.Api:

Public Member Functions

string Version ()
 Returns the current XL Toolbox version as a string. More...
 
int ExportSelection (string fileName, int dpi, string colorSpace, string transparency)
 Exports the current selection to a graphic file. More...
 
void Execute (string command)
 Executes an XL Toolbox command. This method exists to facilitate using Application.OnKey which expects an Excel macro of VBA method as parameter, but does not work with .NET code. Of course, it can also be used to trigger XL Toolbox commands from independent VBA code. More...
 
void ShowException (string message)
 Shows an exception. More...
 
void Log (string message)
 Write a message to the log. More...
 
bool IsDebugMode ()
 Returns true if running in debug mode. More...
 

Properties

static Api Default [get]
 
string LastLog [get, protected set]
 

Detailed Description

Exposes some of the XL Toolbox features to external programs, such as VBA code.

Private Sub ExportSelectionUsingXLToolboxNG()
Dim addin As Office.COMAddIn
Dim apiObject As Object
Set addin = Application.COMAddIns("XLToolboxForExcel")
Set apiObject = addin.Object
Debug.Print apiObject.ExportSelection("test.png", 300, "gray", "white")
End Sub

Member Function Documentation

◆ Execute()

void XLToolbox.Vba.Api.Execute ( string  command)
inline

Executes an XL Toolbox command. This method exists to facilitate using Application.OnKey which expects an Excel macro of VBA method as parameter, but does not work with .NET code. Of course, it can also be used to trigger XL Toolbox commands from independent VBA code.

Parameters
commandXL Toolbox command to execute

Implements XLToolbox.Vba.IApi.

◆ ExportSelection()

int XLToolbox.Vba.Api.ExportSelection ( string  fileName,
int  dpi,
string  colorSpace,
string  transparency 
)
inline

Exports the current selection to a graphic file.

Parameters
fileNameFile name to export to. The file extension must be one of '.tif', '.tiff', '.png' or '.emf'.
dpiResolution in dots per inch (DPI).
colorSpaceTarget color space (one of 'RGB', 'GRAY', 'MONO'; if this string is empty, 'RGB' will be assumed). Note: CMYK is currently not supported by this API function.
transparencyTransparency (one of 'NONE', 'CANVAS', 'WHITE'; if this string is empty, 'NONE' will be assumed).
Returns
0 if successful; 1 if unknown file type; 2 if unknown color space; 3 if unknown transparency type.

Implements XLToolbox.Vba.IApi.

◆ IsDebugMode()

bool XLToolbox.Vba.Api.IsDebugMode ( )
inline

Returns true if running in debug mode.

Implements XLToolbox.Vba.IApi.

◆ Log()

void XLToolbox.Vba.Api.Log ( string  message)
inline

Write a message to the log.

Implements XLToolbox.Vba.IApi.

◆ ShowException()

void XLToolbox.Vba.Api.ShowException ( string  message)
inline

Shows an exception.

Parameters
messageException message.

Implements XLToolbox.Vba.IApi.

◆ Version()

string XLToolbox.Vba.Api.Version ( )
inline

Returns the current XL Toolbox version as a string.

The XL Toolbox follows the semantic versioning scheme, see http://semver.org

Returns
Current XL Toolbox version

Implements XLToolbox.Vba.IApi.

Property Documentation

◆ Default

Api XLToolbox.Vba.Api.Default
staticget

◆ LastLog

string XLToolbox.Vba.Api.LastLog
getprotected set

The documentation for this class was generated from the following file: