For total length of byte stream, I think it is more predictable for end users than us. Such as, if the InputStream is from a simple file, then you can use File.length() or inputStream.available() to get its length. For us to provide a uniform interface, we have to take all type of InputStreams as a common InputStream, it is always unpredictable and we have to use expandable buffer to hold datas read from it.
Anyway, if you really need such an interface, we will look into it.
The problem is that within RPG we can't pass parameters greater then 65535 bytes !!
Do I have to specify an image file ?
I want to embed an AVI-file.
Error --> Unsupported image format when calling addOleObject !!
Message ID . . . . . . : RNX0301 Severity . . . . . . . : 50 Message type . . . . . : Escape Date sent . . . . . . : 08/07/24 Time sent . . . . . . : 12:07:34
Message . . . . : Java exception received when calling Java method. Cause . . . . . : RPG procedure ACELLADDOL in program AAITMRMP1/ACELLSRV received Java exception "java.lang.IllegalArgumentException: Unsupported image foramt." when calling method "addOleObject" with signature "(IIII[B[B)Lcom.aspose.cells.OleObject;" in class "com.aspose.cells.Shapes". Recovery . . . : Contact the person responsible for program maintenance to determine the cause of the problem. Technical description . . . . . . . . : If the exception indicates that the Java class was not found, ensure the class for the method is in the class path. If the exception indicates that the Java method was not found, check the method name and signature. If the signature is not correct, change the RPG prototype for the method, or change the Java method, so that the return
Message . . . . : Java exception received when calling Java method. Cause . . . . . : RPG procedure ACELLADDOL in program AAITMRMP1/ACELLSRV received Java exception "java.lang.IllegalArgumentException: Could not get image reader." when calling method "addOleObject" with signature "(IIII[B[B)Lcom.aspose.cells.OleObject;" in class "com.aspose.cells.Shapes". Recovery . . . : Contact the person responsible for program maintenance to determine the cause of the problem. Technical description . . . . . . . . : If the exception indicates that the Java class was not found, ensure the class for the method is in the class path. If the exception indicates that the Java method was not found, check the method name and signature. If the signature is not correct, change the RPG prototype for the method, or change the Java method, so that the return
Will you provide embedding AVI-objects in the near future ?? (that's what we need)
Do you have any idea what causes error :
received Java exception "java.lang.IllegalArgumentException: Could not get image reader." when calling method "addOleObject" with signature "(IIII[B[B)Lcom.aspose.cells.OleObject;" in class "com.aspose.cells.Shapes".
We will look into this feature and give you estimated time later if we can provide it.
For the Image error, which format of Image do you use? Do you read the image data fully into the byte array and make it as the parameter "imageData" in by calling addOleObject(int row, int column, int left, int top, byte[] imageData, byte[] objectData)?
If the error still persist, please attach your image file here, we will check it soon.
I have tested addOleObject with your attached image file, it works fine. I think maybe you did not read the image data fully and properly into the byte array. My code like following:
Workbook wb = new Workbook(); Shapes shapes = wb.getWorksheets().getSheet(0).getShapes();
When I provide 2 bytearrayoutputstreams to the procedure I get this error !!
In my previous example I provide 2 strings. --> Unsupported image format
Message . . . . : Java exception received when calling Java method. Cause . . . . . : RPG procedure ACELLADDOL in program AAITMRMP1/ACELLSRV received Java exception "java.lang.NoSuchMethodError: addOleObject" when calling method "addOleObject" with signature "(IIIILjava.io.ByteArrayOutputStream;Ljava.io.ByteArrayOutputStream;)Lcom.as pose.cells.OleObject;" in class "com.aspose.cells.Shapes".
Currently Shapes.addOleObject only accept byte[] as datasource for the OleObject's icon image data and object data. We are looking into supporting InputStream as datasource.
Currently Shapes.addOleObject only accept byte[] as datasource for the OleObject's icon image data and object data. We are looking into supporting InputStream as datasource.
Now we support embedding AVI file as OleObject into the Excel file, and we also support use InputStream as the source of image data and OleObject data. please try this attached patch. there are two new methods added for Shapes object for this new feature:
public OleObjectaddOleObject(int row,
int column,
int left,
int top,
byte[] imageData,
byte[] objectData,
byte fileType,
java.lang.String sourceFullName)
Embed an OleObject in the worksheet. Take the file format as MS Office related document.
Parameters:
row - row index of the cell that shape's top-left corner in.
column - column index of the cell that shape's top-left corner in.
left - the horizontal offset of the top left corner of shape and cell, in unit of pixel.
top - the vertical offset of the top left corner of shape and cell, in unit of pixel.
imageData - data of Image as icon of the embeded object
objectData - data of the embeded object
fileType - the embeded object's file type, supproted file type see OleFileType.
sourceFullName - the ole native source full file name
Returns:
the new OleObject embeded in
public OleObjectaddOleObject(int row,
int column,
int left,
int top,
java.io.InputStream imageStream,
java.io.InputStream objectStream,
byte fileType,
java.lang.String sourceFullName)
Embed an OleObject in the worksheet.
Parameters:
row - row index of the cell that shape's top-left corner in.
column - column index of the cell that shape's top-left corner in.
left - the horizontal offset of the top left corner of shape and cell, in unit of pixel.
top - the vertical offset of the top left corner of shape and cell, in unit of pixel.
imageStream - InputStream of the Image as icon of the embeded object
objectStream - InputStream of the embeded object
fileType - the embeded object's file type, supproted file type see OleFileType.
sourceFullName - the ole native source full file name