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.

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 format string of the default empty spreadsheet file.
exportToJson(String filename)Gets JSON format string from memory data with the specified filename.
exportToJsonStringBuilder(String filename)Gets JSON format StringBuilder of the specified spreadsheet file.
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 format StringBuilder from the file cache by the specified unique id.
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)Gets unique id for the file cache.
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)Write JSON of the file to the stream
jsonToStreamByUid(OutputStream stream, String uid, String filename)Write JSON of the file from the cache by the specified unique id 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.

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 format 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 format 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 format string.

exportToJson()

public String exportToJson()

Gets JSON format string of the default empty spreadsheet file.

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

exportToJson(String filename)

public String exportToJson(String filename)

Gets JSON format string from memory data with the specified filename.

Parameters:

ParameterTypeDescription
filenamejava.lang.StringThe filename of the spreadsheet file .

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

exportToJsonStringBuilder(String filename)

public StringBuilder exportToJsonStringBuilder(String filename)

Gets JSON format StringBuilder of the specified spreadsheet file.

Parameters:

ParameterTypeDescription
filenamejava.lang.StringThe filename of the specified spreadsheet file.

Returns: java.lang.StringBuilder - The JSON format 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 format StringBuilder from the file cache by the specified unique id.

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 format 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)

Gets unique id for the file cache.

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)

Write JSON of the file 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)

Write JSON of the file from the cache by the specified unique id 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

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