public final class SpreadsheetInfo extends Object
Constructor and Description |
---|
SpreadsheetInfo() |
Modifier and Type | Method and Description |
---|---|
static void |
addFreeLimitReachedListener(FreeLimitReachedListener listener)
Adds a listener to the event which occurs in loading or saving
ExcelFile when GemBox.Spreadsheet is used with FREE-LIMITED-KEY license key and free limit is reached. |
static void |
clearFreeLimitReachedListeners()
Removes all listeners for free limit reached event.
|
static String |
getFullVersion()
GemBox.Spreadsheet full version.
|
static String |
getTitle()
GemBox.Spreadsheet title.
|
static void |
removeFreeLimitReachedListener(FreeLimitReachedListener listener)
Removes a listener for free limit reached event.
|
static void |
setLicense(String serialKey)
Call this method from your application to set GemBox.Spreadsheet serial key.
|
public static void addFreeLimitReachedListener(FreeLimitReachedListener listener)
ExcelFile
when GemBox.Spreadsheet is used with FREE-LIMITED-KEY license key and free limit is reached.
This event is raised when GemBox.Spreadsheet 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 FreeLimitEventArgs.setFreeLimitReachedAction(com.gembox.spreadsheet.FreeLimitReachedAction)
to
FreeLimitReachedAction.CONTINUE_AS_TRIAL
) or to stop further reading/writing (set FreeLimitEventArgs.setFreeLimitReachedAction(com.gembox.spreadsheet.FreeLimitReachedAction)
to
FreeLimitReachedAction.STOP
).
Trial mode will read and write all file content but will add word "TRIAL" on random places in the file.
For more information about GemBox.Spreadsheet evaluation and licensing, see evaluation and licensing.
Following code demonstrates one way of testing performances of GemBox.Spreadsheet.
SpreadsheetInfo.setLicense("FREE-LIMITED-KEY");
SpreadsheetInfo.addFreeLimitReachedListener(args -> args.setFreeLimitReachedAction(FreeLimitReachedAction.CONTINUE_AS_TRIAL));
long start = System.nanoTime();
ExcelFile ef = ExcelFile.load(fileName);
long elapsed = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start);
System.out.println("Load time: " + elapsed + " milliseconds.");
start = System.nanoTime();
int cellWithValueCount = 0;
for (ExcelWorksheet sheet : ef.getWorksheets())
for (ExcelRow row : sheet.getRows())
for (ExcelCell cell : row.getAllocatedCells())
if (cell.getValue() != null)
++cellWithValueCount;
elapsed = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start);
System.out.println("Iterate through all used cells time: " + elapsed + " milliseconds. Cells with value: " + cellWithValueCount);
start = System.nanoTime();
ef.save(fileName);
elapsed = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start);
System.out.println("Save time: " + elapsed + " milliseconds.");
public static void clearFreeLimitReachedListeners()
public static String getFullVersion()
public static String getTitle()
public static void removeFreeLimitReachedListener(FreeLimitReachedListener listener)
public static void setLicense(String serialKey)
You should call this method before using any other class from GemBox.Spreadsheet library. Key can only be set once (if you try second key, exception will be thrown). The best place to call this method is from static constructor of your application's main class.
Valid serial key has multiple groups of alphanumeric characters, separated with dashes.
Free version serial key is: FREE-LIMITED-KEY.
serialKey
- Serial key.© GemBox d.o.o. — All rights reserved.