expression in picture dose`t work

Stimulsoft Reports.Java discussion
simon ren
Posts: 19
Joined: Wed Nov 21, 2018 12:51 am

expression in picture dose`t work

Post by simon ren » Mon Jan 25, 2021 1:26 am

hello,I user reports.java to render my reports.
i have a picture component in my report,when i use "datacolumn" in my picture it works well.
but when i use "expression " in my picture it does`t works.

Does the picture component support expressions??

The screenshot is as follows

here is the "datacolumn" it works
datacolumn.png
datacolumn
datacolumn.png (133.51 KiB) Viewed 857 times
here is the "expression " it not works
expression.png
expression
expression.png (151.03 KiB) Viewed 857 times
here is the results
result.png
result.png (72.71 KiB) Viewed 857 times
Lech Kulikowski
Posts: 3436
Joined: Tue Mar 20, 2018 5:34 am

Re: expression in picture dose`t work

Post by Lech Kulikowski » Mon Jan 25, 2021 9:41 pm

Hello,

Please send us a sample report with test data that reproduces the issue for analysis.

Thank yuo.
simon ren
Posts: 19
Joined: Wed Nov 21, 2018 12:51 am

Re: expression in picture dose`t work

Post by simon ren » Tue Jan 26, 2021 1:33 am

Lech Kulikowski wrote:
Mon Jan 25, 2021 9:41 pm
Hello,

Please send us a sample report with test data that reproduces the issue for analysis.

Thank yuo.
here is the mrt and test data
PrintFormat.mrt
(12.81 KiB) Downloaded 38 times
PrintData - 副本.json
(223.35 KiB) Downloaded 31 times
HighAley
Posts: 8368
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: expression in picture dose`t work

Post by HighAley » Wed Jan 27, 2021 9:57 pm

Hello,

The expression should return an Image object.
But inside the column we see the Base64 string.
You should use the Data Column in this case.

Thank you.
simon ren
Posts: 19
Joined: Wed Nov 21, 2018 12:51 am

Re: expression in picture dose`t work

Post by simon ren » Thu Jan 28, 2021 2:52 am

HighAley wrote:
Wed Jan 27, 2021 9:57 pm
Hello,

The expression should return an Image object.
But inside the column we see the Base64 string.
You should use the Data Column in this case.

Thank you.
thanks,
i tried use Data Column is ok,but In my business scenario,i need use expression to do some conditional judgment。
you mean that if i use expression like '{cmp2.pic}',then the column ‘pic’ in my datasource must a java Image Objcet not a string?
Lech Kulikowski
Posts: 3436
Joined: Tue Mar 20, 2018 5:34 am

Re: expression in picture dose`t work

Post by Lech Kulikowski » Mon Feb 01, 2021 8:38 pm

Hello,

Yes. Or you can use the Data Column in this case.

Thank you.
simon ren
Posts: 19
Joined: Wed Nov 21, 2018 12:51 am

Re: expression in picture dose`t work

Post by simon ren » Sun Feb 07, 2021 3:02 am

Lech Kulikowski wrote:
Mon Feb 01, 2021 8:38 pm
Hello,

Yes. Or you can use the Data Column in this case.

Thank you.
thanks, i tried set my picture column as a BufferedImage,but it doesn`t work.
like this.

Code: Select all

byte[] bytes1 = new BASE64Decoder().decodeBuffer(ds.tables.get(11).getRows().get(0).getValue("Pic").toString());
ByteArrayInputStream bais = new ByteArrayInputStream(bytes1);
BufferedImage bi1 = ImageIO.read(bais);
ds.tables.get(11).getRows().get(0).setValue("Pic",bi1);
simon ren
Posts: 19
Joined: Wed Nov 21, 2018 12:51 am

Re: expression in picture dose`t work

Post by simon ren » Sat Feb 20, 2021 9:42 am

HighAley wrote:
Wed Jan 27, 2021 9:57 pm
Hello,

The expression should return an Image object.
But inside the column we see the Base64 string.
You should use the Data Column in this case.

Thank you.
thanks, i tried set my picture column as a BufferedImage,but it doesn`t work.
like this.

Code: Select all

byte[] bytes1 = new BASE64Decoder().decodeBuffer(ds.tables.get(11).getRows().get(0).getValue("Pic").toString());
ByteArrayInputStream bais = new ByteArrayInputStream(bytes1);
BufferedImage bi1 = ImageIO.read(bais);
ds.tables.get(11).getRows().get(0).setValue("Pic",bi1);
Vadim
Posts: 273
Joined: Tue Apr 23, 2013 11:23 am

Re: expression in picture dose`t work

Post by Vadim » Tue Feb 23, 2021 12:22 pm

Hello.

ds.tables.get(11).getRows().get(0).setValue("Pic",bi1); is data column, so you need string base64 image here.
simon ren
Posts: 19
Joined: Wed Nov 21, 2018 12:51 am

Re: expression in picture dose`t work

Post by simon ren » Wed Feb 24, 2021 1:10 am

Vadim wrote:
Tue Feb 23, 2021 12:22 pm
Hello.

ds.tables.get(11).getRows().get(0).setValue("Pic",bi1); is data column, so you need string base64 image here.
thanks ,but in my business, we need use Expression,Can you tell me how can i use Expression in Image Component? can you give me some demo?
Post Reply