ComOfficeKitby KDAN API Reference for Windows
Table of Contents

Class License

Namespace
ComOfficeKit
Assembly
ComOfficeKit.dll

Activating ComOfficeKit. Until a licence is active, every operation that reads, writes, renders, exports or compares a document throws LicenseException. Every member is safe to call from any thread.

public static class License
Inheritance
License
Inherited Members

Properties

Expires

When the active licence expires; null when no licence is active or the licence does not say.

public static DateTimeOffset? Expires { get; }

Property Value

DateTimeOffset?

IsEnforced

Whether this engine checks licences. It always does in a package as it ships.

public static bool IsEnforced { get; }

Property Value

bool

LicensedTo

Who the active licence is issued to; null when no licence is active or the licence does not say.

public static string? LicensedTo { get; }

Property Value

string

State

Whether a licence is active.

public static LicenseState State { get; }

Property Value

LicenseState

Methods

Activate(string)

Activates the licence key you were given.

public static void Activate(string key)

Parameters

key string

The key, as a string.

Remarks

A licence issued for one application names the assembly that calls this method: in an ordinary program, the program's own (MyApp for MyApp.exe). Activate at every start: a licence kept from an earlier run is checked against the program's main assembly until you do.

Exceptions

LicenseException

The key is not valid here; Error says why.

ActivateFromFile(string)

Activates the licence file at path.

public static void ActivateFromFile(string path)

Parameters

path string

The licence file.

Remarks

A licence file is read in any of the forms a licence is delivered in: a .lic file, whose Sign= line holds the licence; an XML file, whose first key element holds it; or a text file that holds only the licence. UTF-8, with or without a byte-order mark, or UTF-16 with one. A licence issued for one application names the assembly that calls this method, as for Activate(string).

Exceptions

LicenseException

The licence is not valid here; Error says why.

ComOfficeKitException

IO when the file cannot be read.

CheckUnlocked()

Throws when no valid licence is active, and does nothing otherwise.

public static void CheckUnlocked()

Exceptions

LicenseException

No valid licence is active; Error says why.

Configure(LicenseStorage, string?)

Chooses where the licence is kept. Call it before Activate(string) or ActivateFromFile(string) when the default, Persistent, is not what you want.

public static void Configure(LicenseStorage storage = LicenseStorage.Persistent, string? storageIdentifier = null)

Parameters

storage LicenseStorage

Where to keep the licence.

storageIdentifier string

A name of your own for the stored licence, so that two applications on one machine keep theirs apart; null for the default.

Deactivate()

Removes the active licence, and the stored one with it.

public static void Deactivate()