expression in picture dose`t work

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

expression in picture dose`t work

Post by simon ren »

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
datacolumn
datacolumn.png (133.51 KiB) Viewed 4611 times
here is the "expression " it not works
expression
expression
expression.png (151.03 KiB) Viewed 4611 times
here is the results
result.png
result.png (72.71 KiB) Viewed 4611 times
Lech Kulikowski
Posts: 6196
Joined: Tue Mar 20, 2018 5:34 am

Re: expression in picture dose`t work

Post by Lech Kulikowski »

Hello,

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

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

Re: expression in picture dose`t work

Post by simon ren »

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 293 times
PrintData - 副本.json
(223.35 KiB) Downloaded 257 times
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: expression in picture dose`t work

Post by HighAley »

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: 67
Joined: Wed Nov 21, 2018 12:51 am

Re: expression in picture dose`t work

Post by simon ren »

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: 6196
Joined: Tue Mar 20, 2018 5:34 am

Re: expression in picture dose`t work

Post by Lech Kulikowski »

Hello,

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

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

Re: expression in picture dose`t work

Post by simon ren »

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: 67
Joined: Wed Nov 21, 2018 12:51 am

Re: expression in picture dose`t work

Post by simon ren »

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: 362
Joined: Tue Apr 23, 2013 11:23 am

Re: expression in picture dose`t work

Post by Vadim »

Hello.

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

Re: expression in picture dose`t work

Post by simon ren »

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