Click or drag to resize
SpreadsheetInfoFreeLimitReached Event
Occurs in loading or saving ExcelFile when GemBox.Spreadsheet assembly is used with FREE-LIMITED-KEY license key and free limit is reached.

Namespace:  GemBox.Spreadsheet
Assembly:  GemBox.Spreadsheet (in GemBox.Spreadsheet.dll) Version: 41.3.30.1032
Syntax
public static event EventHandler<FreeLimitEventArgs> FreeLimitReached

Value

Type: SystemEventHandlerFreeLimitEventArgs
Remarks
This event is raised when GemBox.Spreadsheet assembly is used with FREE-LIMITED-KEY license key and maximum number of rows (150 rows) or sheets (5 sheets) are reached.

Free mode will read / write first 150 rows/5 sheets normally and, if file has more than 150 rows or 5 sheets, it will throw FreeLimitReachedException.

You can use this event to continue using the assembly in a trial mode for performance testing (set FreeLimitReachedAction to ContinueAsTrial) or to stop further reading/writing (set FreeLimitReachedAction to Stop).

Trial mode will read and write all file content but will insert word "TRIAL" on random places in the file.

For more information about GemBox.Spreadsheet evaluation and licensing, see evaluation and licensing.

Examples

Following code demonstrates one way of testing performances of GemBox.Spreadsheet.

SpreadsheetInfo.SetLicense("FREE-LIMITED-KEY");

SpreadsheetInfo.FreeLimitReached += (sender, e) => e.FreeLimitReachedAction = FreeLimitReachedAction.ContinueAsTrial;

Stopwatch sw = new Stopwatch();

sw.Start();
ExcelFile ef = ExcelFile.Load(fileName);
sw.Stop();
Console.WriteLine("Load time: " + sw.Elapsed.TotalSeconds + " seconds.");

sw.Reset();
sw.Start();
int cellWithValueCount = 0;
foreach (var sheet in ef.Worksheets)
    foreach (var row in sheet.Rows)
        foreach (var cell in row.AllocatedCells)
            if (cell.Value != null)
                ++cellWithValueCount;
sw.Stop();
Console.WriteLine("Iterate through all used cells time: " + sw.Elapsed.TotalSeconds + " seconds. Cells with value: " + cellWithValueCount);

sw.Reset();
sw.Start();
ef.Save(fileName);
sw.Stop();
Console.WriteLine("Save time: " + sw.Elapsed.TotalSeconds + " seconds.");
See Also