GridJsWorkbook

Inheritance: java.lang.Object

public class GridJsWorkbook

Represents the main entry class for GridJs

Constructors

ConstructorDescription
GridJsWorkbook()

Fields

FieldDescription
CacheImpCustom implemention for cache storage,If you want to store cache in stream way ,you need to set and implement it.
CalculateEngineCustom implemention for calculation engine ,If you want to do custom calculation, you need to set and implement it.
UpdateMonitorGets/Sets the update monitor to track update operation

Methods

MethodDescription
copyImageOrShape(String uid, String p)Copys image or shape.
equals(Object arg0)
errorJson(String msg)Gets the error message string in JSON format.
exportToJson()Gets JSON string from memory data, the default filename in the JSON is: book1.
exportToJson(String filename)Gets JSON string from memory data,set the output filename in the JSON.
exportToJsonStringBuilder(String filename)Gets JSON string from memory data,set the output filename in the JSON.
getClass()
getGridLoadFormat(String extension)Gets the load format by file extension
getImageStream(String uid, String picid)Get Stream of image from memory data.
getImageUrl(String uid, String picid, String delimiter)Gets the image URL.
getJsonByUid(String uid, String filename)Gets the JSON string of the file from the cache using the specified unique id,set the output filename in the JSON.
getOle(String uid, String sheetname, int oleid, String label)Gets the byte array data of the embedded ole object .
getSettings()Represents the workbook settings.
getUidForFile(String fileName)Generates a new unique id for the file cache using the given file name.
hashCode()
importExcelFile(InputStream filestream, int format)Imports the excel file from file stream with load format.
importExcelFile(InputStream filestream, int format, String password)Imports the excel file from file stream with load format and open password.
importExcelFile(String fileName)Imports the excel file from the file path.
importExcelFile(String uid, InputStream filestream, int format)Imports the excel file from file stream.
importExcelFile(String uid, InputStream filestream, int format, String password)Imports the excel file from file stream with load format and open password.
importExcelFile(String uid, String fileName)Imports the excel file from the file path.
importExcelFile(String uid, String fileName, String password)Imports the excel file from file path and open password.
importExcelFileFromJson(String json)Imports the excel file from JSON format string.
insertImage(String uid, String p, InputStream s, String imageUrl)Inserts image in the worksheet from file stream or the URL,(either the file stream or the URL shall be provided) or Inserts shape ,when the p.type is one of AutoShapeType
jsonToStream(OutputStream stream, String filename)Retrieve the JSON string from memory data,set the output filename in the JSON, and write it to the stream.
jsonToStreamByUid(OutputStream stream, String uid, String filename)Retrieve the JSON string of the file from the cache using the specified unique id,set the output filename in the JSON,and write it to the stream.
lazyLoadingJson(String uid, String sheetName)Gets the JSON string of the specified sheet in the file from the cache using the specified unique id.
lazyLoadingStream(OutputStream stream, String uid, String sheetName)Retrieve the JSON string of the specified sheet in the file from the cache using the specified unique id, and write it to the stream.
mergeExcelFileFromJson(String uid, String json)Applies a batch update to the memory data.
notify()
notifyAll()
saveToCacheWithFileName(String uid, String filename, String password)Saves the memory data to the cache file with the specified filename and also set the open password, the save format is baseed on the file extension of the filename .
saveToExcelFile(OutputStream stream)Saves the memory data to the sream, baseed on the origin file format.
saveToExcelFile(String path)Saves the memory data to the file path,if the file has extension ,save format is baseed on the file extension .
saveToHtml(OutputStream stream)Saves the memory data to the sream,the save format is html
saveToHtml(String path)Saves the memory data to the file path,the save format is html.
saveToPdf(OutputStream stream)Saves the memory data to the sream,the save format is pdf.
saveToPdf(String path)Saves the memory data to the file path,the save format is pdf.
saveToXlsx(OutputStream stream)Saves the memory data to the sream,the save format is xlsx.
saveToXlsx(String path)Saves the memory data to the file path,the save format is xlsx.
setImageUrlBase(String baseImageURL)Set the base image get action URL from controller .
setInterruptMonitorForLoad(GridInterruptMonitor monitor, int calculateTimeoutMilliseconds)Sets InterruptMonitor for load operation.
setInterruptMonitorForSave(GridInterruptMonitor monitor)Sets InterruptMonitor for save operation.
setSettings(GridWorkbookSettings value)Represents the workbook settings.
toString()
updateCell(String p, String uid)Applies the update operation.
wait()
wait(long arg0)
wait(long arg0, int arg1)

GridJsWorkbook()

public GridJsWorkbook()

CacheImp

public static GridCacheForStream CacheImp

Custom implemention for cache storage,If you want to store cache in stream way ,you need to set and implement it.

CalculateEngine

public static GridAbstractCalculationEngine CalculateEngine

Custom implemention for calculation engine ,If you want to do custom calculation, you need to set and implement it.

UpdateMonitor

public static GridUpdateMonitor UpdateMonitor

Gets/Sets the update monitor to track update operation

copyImageOrShape(String uid, String p)

public String copyImageOrShape(String uid, String p)

Copys image or shape.

Parameters:

ParameterTypeDescription
uidjava.lang.StringThe unique id for the file cache.
pjava.lang.StringThe JSON string for the operation which specify the cell location ,it contains the worksheet name,upper left row,upper left column for the image or shape\u951b\u5b94tc {name:‘sheet1’,ri:1,ci:1,srcid:2,srcname:‘sheet2’,isshape:true}

Returns: java.lang.String - The JSON string of the new copied image

equals(Object arg0)

public boolean equals(Object arg0)

Parameters:

ParameterTypeDescription
arg0java.lang.Object

Returns: boolean

errorJson(String msg)

public String errorJson(String msg)

Gets the error message string in JSON format.

Parameters:

ParameterTypeDescription
msgjava.lang.StringThe error message.

Returns: java.lang.String - The JSON string.

exportToJson()

public String exportToJson()

Gets JSON string from memory data, the default filename in the JSON is: book1.

Returns: java.lang.String - The JSON string.

exportToJson(String filename)

public String exportToJson(String filename)

Gets JSON string from memory data,set the output filename in the JSON.

Parameters:

ParameterTypeDescription
filenamejava.lang.StringSpecifies the file name in the JSON. If set to null,the default filename is: book1..

Returns: java.lang.String - The JSON string.

exportToJsonStringBuilder(String filename)

public StringBuilder exportToJsonStringBuilder(String filename)

Gets JSON string from memory data,set the output filename in the JSON.

Parameters:

ParameterTypeDescription
filenamejava.lang.StringSpecifies the file name in the JSON. If set to null,the default filename is: book1..

Returns: java.lang.StringBuilder - The JSON StringBuilder.

getClass()

public final native Class<?> getClass()

Returns: java.lang.Class

getGridLoadFormat(String extension)

public static int getGridLoadFormat(String extension)

Gets the load format by file extension

Parameters:

ParameterTypeDescription
extensionjava.lang.StringThe file extention ,usually start with ‘.’ .

Returns: int - GridLoadFormat.

getImageStream(String uid, String picid)

public static InputStream getImageStream(String uid, String picid)

Get Stream of image from memory data.

Parameters:

ParameterTypeDescription
uidjava.lang.StringThe unique id for the file cache.
picidjava.lang.StringThe image id.

Returns: java.io.InputStream -

getImageUrl(String uid, String picid, String delimiter)

public static String getImageUrl(String uid, String picid, String delimiter)

Gets the image URL.

Parameters:

ParameterTypeDescription
uidjava.lang.StringThe unique id for the file cache.
picidjava.lang.StringThe image id.
delimiterjava.lang.StringThe string delimiter.

Returns: java.lang.String -

getJsonByUid(String uid, String filename)

public StringBuilder getJsonByUid(String uid, String filename)

Gets the JSON string of the file from the cache using the specified unique id,set the output filename in the JSON.

Parameters:

ParameterTypeDescription
uidjava.lang.StringThe unique id for the file cache.
filenamejava.lang.StringSpecifies the file name in the JSON. If set to null,the default filename is: book1.

Returns: java.lang.StringBuilder - The JSON string StringBuilder

getOle(String uid, String sheetname, int oleid, String label)

public byte[] getOle(String uid, String sheetname, int oleid, String label)

Gets the byte array data of the embedded ole object .

Parameters:

ParameterTypeDescription
uidjava.lang.StringThe unique id for the file cache.
sheetnamejava.lang.StringThe worksheet name.
oleidintThe id for the embedded ole object.
labeljava.lang.StringThe display label of the embedded ole object.

Returns: byte[] - The byte array data of the embedded ole object .

getSettings()

public GridWorkbookSettings getSettings()

Represents the workbook settings.

Returns: GridWorkbookSettings

getUidForFile(String fileName)

public static String getUidForFile(String fileName)

Generates a new unique id for the file cache using the given file name.

Parameters:

ParameterTypeDescription
fileNamejava.lang.StringThe file name.

Returns: java.lang.String -

hashCode()

public native int hashCode()

Returns: int

importExcelFile(InputStream filestream, int format)

public void importExcelFile(InputStream filestream, int format)

Imports the excel file from file stream with load format.

Parameters:

ParameterTypeDescription
filestreamjava.io.InputStreamThe stream of the excel file .
formatintGridLoadFormat. The LoadFormat of the excel file.

importExcelFile(InputStream filestream, int format, String password)

public void importExcelFile(InputStream filestream, int format, String password)

Imports the excel file from file stream with load format and open password.

Parameters:

ParameterTypeDescription
filestreamjava.io.InputStreamThe stream of the excel file .
formatintGridLoadFormat. The LoadFormat of the excel file.
passwordjava.lang.StringThe open password of the excel file.The value can be null If no passowrd is set.

importExcelFile(String fileName)

public void importExcelFile(String fileName)

Imports the excel file from the file path.

Parameters:

ParameterTypeDescription
fileNamejava.lang.StringThe full path of the file.

importExcelFile(String uid, InputStream filestream, int format)

public void importExcelFile(String uid, InputStream filestream, int format)

Imports the excel file from file stream.

Parameters:

ParameterTypeDescription
uidjava.lang.StringThe unique id for the file cache, if set to null,it will be generated automatically.
filestreamjava.io.InputStreamThe stream of the excel file .
formatintGridLoadFormat. The LoadFormat of the excel file.

importExcelFile(String uid, InputStream filestream, int format, String password)

public void importExcelFile(String uid, InputStream filestream, int format, String password)

Imports the excel file from file stream with load format and open password.

Parameters:

ParameterTypeDescription
uidjava.lang.StringThe unique id for the file cache, if set to null,it will be generated automatically.
filestreamjava.io.InputStreamThe stream of the excel file .
formatintGridLoadFormat. The LoadFormat of the excel file.
passwordjava.lang.StringThe open password of the excel file.The value can be null If no passowrd is set

importExcelFile(String uid, String fileName)

public void importExcelFile(String uid, String fileName)

Imports the excel file from the file path.

Parameters:

ParameterTypeDescription
uidjava.lang.StringThe unique id for the file cache, if set to null,it will be generated automatically.
fileNamejava.lang.StringThe full path of the file.

importExcelFile(String uid, String fileName, String password)

public void importExcelFile(String uid, String fileName, String password)

Imports the excel file from file path and open password.

Parameters:

ParameterTypeDescription
uidjava.lang.StringThe unique id for the file cache, if set to null,it will be generated automatically.
fileNamejava.lang.StringThe full path of the file.
passwordjava.lang.StringThe open password of the excel file.The value can be null If no passowrd is set.

importExcelFileFromJson(String json)

public void importExcelFileFromJson(String json)

Imports the excel file from JSON format string.

Parameters:

ParameterTypeDescription
jsonjava.lang.StringThe JSON format string.

insertImage(String uid, String p, InputStream s, String imageUrl)

public String insertImage(String uid, String p, InputStream s, String imageUrl)

Inserts image in the worksheet from file stream or the URL,(either the file stream or the URL shall be provided) or Inserts shape ,when the p.type is one of AutoShapeType

Parameters:

ParameterTypeDescription
uidjava.lang.StringThe unique id for the file cache
pjava.lang.StringThe JSON format string for the operation which specify the cell location ,the worksheet name,upper left row,upper left column for the image\u951b\u5b94tc {name:‘sheet1’,ri:1,ci:1}
sjava.io.InputStreamThe file stream of the image file
imageUrljava.lang.StringThe URL of the image file

Returns: java.lang.String - The JSON format string of the inserted image

jsonToStream(OutputStream stream, String filename)

public void jsonToStream(OutputStream stream, String filename)

Retrieve the JSON string from memory data,set the output filename in the JSON, and write it to the stream.

Parameters:

ParameterTypeDescription
streamjava.io.OutputStreamThe stream that will be written
filenamejava.lang.StringSpecifies the file name in the JSON. If set to null,the default filename is: book1.

jsonToStreamByUid(OutputStream stream, String uid, String filename)

public boolean jsonToStreamByUid(OutputStream stream, String uid, String filename)

Retrieve the JSON string of the file from the cache using the specified unique id,set the output filename in the JSON,and write it to the stream.

Parameters:

ParameterTypeDescription
streamjava.io.OutputStreamThe stream that will be written
uidjava.lang.StringThe unique id for the file cache.
filenamejava.lang.StringSpecifies the file name in the JSON. If set to null,the default filename is: book1.

Returns: boolean

lazyLoadingJson(String uid, String sheetName)

public StringBuilder lazyLoadingJson(String uid, String sheetName)

Gets the JSON string of the specified sheet in the file from the cache using the specified unique id.

Parameters:

ParameterTypeDescription
uidjava.lang.StringThe unique id for the file cache.
sheetNamejava.lang.Stringthe sheet name.

Returns: java.lang.StringBuilder - The JSON string StringBuilder

lazyLoadingStream(OutputStream stream, String uid, String sheetName)

public void lazyLoadingStream(OutputStream stream, String uid, String sheetName)

Retrieve the JSON string of the specified sheet in the file from the cache using the specified unique id, and write it to the stream.

Parameters:

ParameterTypeDescription
streamjava.io.OutputStreamThe stream that will be written
uidjava.lang.StringThe unique id for the file cache.
sheetNamejava.lang.Stringthe sheet name.

mergeExcelFileFromJson(String uid, String json)

public void mergeExcelFileFromJson(String uid, String json)

Applies a batch update to the memory data.

Parameters:

ParameterTypeDescription
uidjava.lang.StringThe unique id for the file cache.
jsonjava.lang.StringThe update JSON format string.

notify()

public final native void notify()

notifyAll()

public final native void notifyAll()

saveToCacheWithFileName(String uid, String filename, String password)

public void saveToCacheWithFileName(String uid, String filename, String password)

Saves the memory data to the cache file with the specified filename and also set the open password, the save format is baseed on the file extension of the filename .

Parameters:

ParameterTypeDescription
uidjava.lang.StringThe unique id for the file cache.
filenamejava.lang.StringThe filename to save.
passwordjava.lang.StringThe excel file’s open password. The value can be null If no passowrd is set.

saveToExcelFile(OutputStream stream)

public void saveToExcelFile(OutputStream stream)

Saves the memory data to the sream, baseed on the origin file format.

Parameters:

ParameterTypeDescription
streamjava.io.OutputStreamThe stream to save.

saveToExcelFile(String path)

public void saveToExcelFile(String path)

Saves the memory data to the file path,if the file has extension ,save format is baseed on the file extension .

Parameters:

ParameterTypeDescription
pathjava.lang.StringThe file path to save.

saveToHtml(OutputStream stream)

public void saveToHtml(OutputStream stream)

Saves the memory data to the sream,the save format is html

Parameters:

ParameterTypeDescription
streamjava.io.OutputStreamThe stream to save.

saveToHtml(String path)

public void saveToHtml(String path)

Saves the memory data to the file path,the save format is html.

Parameters:

ParameterTypeDescription
pathjava.lang.StringThe file path to save.

saveToPdf(OutputStream stream)

public void saveToPdf(OutputStream stream)

Saves the memory data to the sream,the save format is pdf.

Parameters:

ParameterTypeDescription
streamjava.io.OutputStreamThe stream to save.

saveToPdf(String path)

public void saveToPdf(String path)

Saves the memory data to the file path,the save format is pdf.

Parameters:

ParameterTypeDescription
pathjava.lang.StringThe file path to save.

saveToXlsx(OutputStream stream)

public void saveToXlsx(OutputStream stream)

Saves the memory data to the sream,the save format is xlsx.

Parameters:

ParameterTypeDescription
streamjava.io.OutputStreamThe stream to save.

saveToXlsx(String path)

public void saveToXlsx(String path)

Saves the memory data to the file path,the save format is xlsx.

Parameters:

ParameterTypeDescription
pathjava.lang.StringThe file path to save.

setImageUrlBase(String baseImageURL)

public static void setImageUrlBase(String baseImageURL)

Set the base image get action URL from controller .

Remarks

when CacheImp is null,we need to set this .

Parameters:

ParameterTypeDescription
baseImageURLjava.lang.Stringthe base image get action URL.

setInterruptMonitorForLoad(GridInterruptMonitor monitor, int calculateTimeoutMilliseconds)

public void setInterruptMonitorForLoad(GridInterruptMonitor monitor, int calculateTimeoutMilliseconds)

Sets InterruptMonitor for load operation.

Parameters:

ParameterTypeDescription
monitorGridInterruptMonitorThe InterruptMonitor instance.
calculateTimeoutMillisecondsintThe time out in millisecond for load file.

setInterruptMonitorForSave(GridInterruptMonitor monitor)

public void setInterruptMonitorForSave(GridInterruptMonitor monitor)

Sets InterruptMonitor for save operation.

Parameters:

ParameterTypeDescription
monitorGridInterruptMonitorThe InterruptMonitor instance.

setSettings(GridWorkbookSettings value)

public void setSettings(GridWorkbookSettings value)

Represents the workbook settings.

Parameters:

ParameterTypeDescription
valueGridWorkbookSettings

toString()

public String toString()

Returns: java.lang.String

updateCell(String p, String uid)

public String updateCell(String p, String uid)

Applies the update operation.

Parameters:

ParameterTypeDescription
pjava.lang.StringThe JSON format string of update operation.
uidjava.lang.StringThe unique id for the file cache.

Returns: java.lang.String - The JSON format string of the update result.

wait()

public final void wait()

wait(long arg0)

public final native void wait(long arg0)

Parameters:

ParameterTypeDescription
arg0long

wait(long arg0, int arg1)

public final void wait(long arg0, int arg1)

Parameters:

ParameterTypeDescription
arg0long
arg1int