Hans Werner
Top achievements
Rank 1
Hans Werner
asked on 19 Nov 2009, 08:17 AM
Hello Telerik Team,
i'm evaluating your great reporting product, but i have some little problems and i hope to find some help here.
I've draged a PictureBox into my report (detail section) and made the following Expression to load a harddrive stored picture into it:
This is working perfectly as long as the picture with the filname "articleNo+.jpg" exists in the given harddrive folder. If there isn't a picture for the specific article (which is a common situation for our needs), i get the following error in the report output (for every not existing picture in a list with 5000 articles ...):
"An error has occured while processing PictureBox "pictureBox1': The File "C:\ProductPictures\ART00001.jpg" could not be found."
Is there a way to supress the error message if the picture doesn't exists? We don't need and want this error message =)
Best Regards from Germany
Hans
i'm evaluating your great reporting product, but i have some little problems and i hope to find some help here.
I've draged a PictureBox into my report (detail section) and made the following Expression to load a harddrive stored picture into it:
= Format("C:\ProductPictures\{0}.jpg", Fields.articleNo) |
This is working perfectly as long as the picture with the filname "articleNo+.jpg" exists in the given harddrive folder. If there isn't a picture for the specific article (which is a common situation for our needs), i get the following error in the report output (for every not existing picture in a list with 5000 articles ...):
"An error has occured while processing PictureBox "pictureBox1': The File "C:\ProductPictures\ART00001.jpg" could not be found."
Is there a way to supress the error message if the picture doesn't exists? We don't need and want this error message =)
Best Regards from Germany
Hans
11 Answers, 1 is accepted
0
Hans Werner
Top achievements
Rank 1
answered on 19 Nov 2009, 11:33 AM
No ideas for solving this problem?
0
Hans Werner
Top achievements
Rank 1
answered on 19 Nov 2009, 01:58 PM
Here a possible solution for everyone lookin for:
Make a user function:
In the picturebox expression, extend the statement from
to
And everything works fine. You just need to create a 1x1 pixel default.jpg image in your app directory which will be used if the other picture doesn't exist.
Have fun!
Make a user function:
public static String PicturePath(String sCompletePath) |
{ |
String sFinalPath = ""; |
if (File.Exists(sCompletePath)) |
sFinalPath = sCompletePath; |
else |
{ |
String sCurrentAppDirectory = System.IO.Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath); |
sFinalPath = sCurrentAppDirectory + "\\default.jpg"; |
} |
return sFinalPath; |
} |
In the picturebox expression, extend the statement from
= Format("C:\ProductPictures\{0}.jpg", Fields.articleNo) |
= TelerikReportTutorial.ArticleList.PicturePath(Format("D:\Work\OBI\Artikel-Bilder\{0}.jpg", Fields.articleNo)) |
And everything works fine. You just need to create a 1x1 pixel default.jpg image in your app directory which will be used if the other picture doesn't exist.
Have fun!
0
Rafa
Top achievements
Rank 1
answered on 16 Jan 2015, 03:01 AM
Hi,
Is there any official solution for this yet?
Regards,
Rafa
Is there any official solution for this yet?
Regards,
Rafa
0
KS
Top achievements
Rank 1
answered on 20 Jan 2015, 10:00 AM
Hi,
User functions do the work for me and let me check if the image exists on the server. Maybe you are searching for some error handling like with Report.Error event.
-KS
User functions do the work for me and let me check if the image exists on the server. Maybe you are searching for some error handling like with Report.Error event.
-KS
0
Rafa
Top achievements
Rank 1
answered on 12 Feb 2015, 02:30 AM
Hi KS,
Yes, currently I am using user function similar to Hans Werner's post above. But I wonder if a built in function for this will be available sooner or later.
Regards,
Rafa
Yes, currently I am using user function similar to Hans Werner's post above. But I wonder if a built in function for this will be available sooner or later.
Regards,
Rafa
0
KS
Top achievements
Rank 1
answered on 16 Feb 2015, 01:36 PM
Hi,
Sounds like a feature request. I think this is a matter of error handling (to have a missing image is an unexpected behavior resulting in an error) and there is no common solution. Sometimes it is better to have a default image instead of a blank space or broken image. Sometimes blank space is the expected result.
-KS
Sounds like a feature request. I think this is a matter of error handling (to have a missing image is an unexpected behavior resulting in an error) and there is no common solution. Sometimes it is better to have a default image instead of a blank space or broken image. Sometimes blank space is the expected result.
-KS
0
doli
Top achievements
Rank 1
answered on 09 Dec 2016, 06:31 AM
Hi
please find attached file,
I need to put image from the url and conditionally like "intead of 50/93.75/100% replace all of those with either thumbs
up/down(image). If greater than 50% then it's thumbs up and if its 50% or less its thumbs down (image)"
I need to replace image to 50 % .
my expression is =IIf(Fields.Allowed_to_Miss < Fields.W,"50"+"%",cDbl(Fields.R) / cDbl(Fields.R + Fields.W))
Please help. Thank you in advance.
Thanks,
Doli
0
doli
Top achievements
Rank 1
answered on 09 Dec 2016, 11:19 AM
Is anybody here please help me.
0
doli
Top achievements
Rank 1
answered on 17 Mar 2017, 01:27 PM
Hi
Can you please help me?
when we generate PDF we get error for picturebox.
An error has occurred while processing PictureBox 'pbxPMPic':
Invalid image data.
------------- InnerException -------------
The remote server returned an error: (404) Not Found
We have used URL of image like
='http://mellowedout.zap-drd.com/images/' + iif(Fields.PMPic='', 'clearpix.gif', 'inspections/' + Parameters.InspectionId.Value + '/' + Fields.PMPic)
in the report.
you can check with attach file.
Can you please help me?
when we generate PDF we get error for picturebox.
An error has occurred while processing PictureBox 'pbxPMPic':
Invalid image data.
------------- InnerException -------------
The remote server returned an error: (404) Not Found
We have used URL of image like
='http://mellowedout.zap-drd.com/images/' + iif(Fields.PMPic='', 'clearpix.gif', 'inspections/' + Parameters.InspectionId.Value + '/' + Fields.PMPic)
in the report.
you can check with attach file.
0
Hello doli,
You can use the same expression as TextBox item's Value property to check ho wit is resolved. You can also test the produced URL in browser and edit the URL to get the correct address of the image resource.
I hope this helps.
Regards,
Stef
Telerik by Progress
You can use the same expression as TextBox item's Value property to check ho wit is resolved. You can also test the produced URL in browser and edit the URL to get the correct address of the image resource.
I hope this helps.
Regards,
Stef
Telerik by Progress
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Feedback Portal
and vote to affect the priority of the items
0
doli
Top achievements
Rank 1
answered on 22 Mar 2017, 04:05 AM
I have checked URL in broweser its working but when I put on picture box its giving me error like below
http://mellowedout.zap-drd.com/images/clearpix.gif
Invalid image data.------------- InnerException -------------
The remote server returned an error: (404) Not Found