load dynamic image from path in crystal report - c#

I want to show an image in my report , I save path of image in my sqlserver database and now I want to load image from path .I search all of internet for that and try all of guidance , I first insert image into my report and after that I go to >Format Editor > picture > Graphic Location > and insert path of image into the textarea like this {Command.path} but when I run , it doesn't show any picture . Now how should I do ?
I use visual studio 2013 and latest version of crystal report .

Use a conditional formula to dynamically change the location of a report’s image.
1. Add an image to the report: -> Insert -> Picture
This image will act as a placeholder.
Ensure that the placeholder is the same size as the one that will be dynamically loaded, otherwise, the image will be scaled.
2. Change the image’s Graphic Location:
->right click image
->select Format Graphic…
->select Picture tab
->click the conditional-formula button (looks like x+2)
->set the formula’s text to the name of the formula or parameter field that will contain the image’s URL
->save the formula and click the OK button
->Save the report
It worked for me.
Source: cogniza.com

You can actually do it by:
Add a datasource for your report. Be sure to include the path image.
Add a default image.
From Format Editor > picture > Graphic Location , add the path image field.

According to this, you're doing it right. Perhaps try to set a formula field equal to {Command.path} and use that instead to see if crystal just isn't parsing it properly? That way you can display the formula field and see how it displays. Perhaps you're storing it in the DB with quotation marks or spaces? Alternatively, using a parameter should definitely work, so you could make a sub-report with {Command.path} as a parameter that it uses to load up the image.

Related

How can you put logo on your CrystalReport within the Header? [duplicate]

I need to insert a report homepage on an existing RPT file. The existing RPT file works fine, it displays results from a stored procedure. It's ok.
The homepage must contain an image from the database. So first, I added a new SQL command (through the window "Database Expert") with a new SQL query in order to get the image logo. I drag & drop the image field in the Report Header section. It works in the designer, I can see the image which is retrieved from the database.
But when I generate the report, my SQL query which get the image is executed several times... I can see it in my SQL profiler... I think that my query is executed FOR EACH row which is returned by the initial stored procedure... I don't know why.
Version of Crystal Reports : 10.2
Any ideas ? Thanks a lot.
If you just need to add a single image that is not bound to any data (i.e. image of product you are listing in your report), you can easily add a picture from the file system by following these simple steps:
1) Click "Insert" from the file menu
2) Select Picture
3) Browse to the picture file
4) Select the file and then click the place in the report where you want to put the image
5) After inserting the picture you can click on it and move/resize
I finally found the following solution :
1 > Create a new SubReport. (Right click on the designer > Insert > SubReport). This new SubReport will be related to the table which contain the image data.
2 > Ensure that this sub report is in the Report Header section. Remove black borders if needed.
3 > In the SubReport, drag your image SQL field into the Details section. Don't forget to specify an equals-condition in order to retrieve the right image.

Crystal Report Cross Tab Custom Total

Scenario is,
I want to make cross tab crystal report like below image
I made cross tab report shown below but it showing obtain marks total only, I want proper percentage at end ((ObtainMarks/TotalMarks)*100)
help me to sort out pls. im new to corss tab. Its my 4th day on seraching about this topic
You need to use calculated member to achieve this.
Go to preview on last column right click --> calculated member --> insert
You will get a new column added and in that edit the formula for the column and write your formula
#Siva this is my Preview Tab for Report, It showing empty Cross tab options.
Dataset for this report is made in Visual studio. I Select that Dataset as ADO.NET(XML)
I have resolved my Issue on SCN Forum at
http://scn.sap.com/thread/3871853
.#Siva's Answer is start point to solution

NotShowing Data-Bound Image (Reporting Services)

I Create an SendWorkOrder.rdl Report for SSRS. In the dataSet I have a field with Image dataType(Value in that database column eg- 0x89504E470D0A1A0A000000....).
Followed msdn article to create data bound image.
I Tried following expressions, But Image Not Showing
=First(Fields!Signature.Value, "CasingList")
=System.Convert.FromBase64String(Mid(System.Convert.ToBase64String(Fields!Signature.Value),105))
=Convert.FromBase64String(First(Fields!Signature.Value, "CasingList"))
You are trying to create an image in your report from the database?
I assume you have set up an image control as follows
Then set the field to be a reference to your 0x89504E470D0A1A0A000000... data
=Fields!Marker.Value
And the Mime type to the the corresponding image format
=Fields!Marker_Type.Value
(note this should be something like image/jpeg or image/png)
Without the image format nothing will render.
A set up such as the above should render correctly, as shown
--> becomes -->

dynamic image in rdlc not appear correctly

I have this hirarcy in my project
Report forlder -> Image Folder , Reports -> Rdlc
in rdlc I set the image source to external and use parameter
when add the parameter to report call the report not appear
I write the parameter like
"file:images\icon.jpg" is there an certain extension to use or why this cause the report to not appear ,I tried to remove the image and the report work fine
you should pass the complete image path to your image in this way if you pass it like you've done I don't thik it will work.
ReportViewer1.LocalReport.EnableExternalImages = true;
ReportViewer1.LocalReport.SetParameters(new ReportParameter("image", "file:///" + Server.MapPath("~/images/icon.jpg",true));

How to fix image on Report.rdlc by giving path?

I don't want save image in database. My application going to work on different shops i want show their logos on report.rdlc. For that i want to know, can i show image on report.rdlc by using path of image only? I tried to create parameter for Report.rdlc in ReportData but there is not any image Datatype.
Yes, you can:
Set image Source to External
Set image Value to an URL or file path
Set EnableExternalImages=true in your report code
You can also refer to http://msdn.microsoft.com/en-us/library/ms251715(v=vs.80).aspx for some additional info, but those steps above must be enough.

Categories