Draw a line in crystal report - crystal-reports

I want to draw a line in Crystal report. I can do that from a sub-menu but this line I need to draw in a Group section Field object with a background color property set to some color.
So whenever I draw a line it gets overlapped by this FieldObject.
How can I make sure that line would be visible over the background color of object?

Assuming you are doing this through the designer, you should just be able to right-click on your line and select "Move to Front".

Insert section below section that contains the FieldObject
Add line to new section
Format the first section (the one with the field object) as 'underlay following section(s)'

Related

How to show and hide a LineObject by using formula in crystal report?

I'm using a Crystal Report connected with VB.NET 2010, here I using a Line object, which I need to show or hide depending on data field. Where do I need to set the formula?
This project I use is running with SQL 2008 and VB.NET 2010. I've tried some Formula Field for this topic. But the result is not look like that I want to show.
I use the following code on Formula Field:-
IF isNull({PrintParticularList.CUST_INVOICE_No}) or {PrintParticularList.CUST_INVOICE_No}=""
THEN
""
ELSE
"--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------"
I also try this following Code :-
IF isNull({PrintParticularList.SLNO}) or {PrintParticularList.CUST_INVOICE_No}=""
THEN
Line25.Suppress=True
ELSE
Line25.Suppress=False
But here I got error on Line25.
A number, currency amount,boolean, date, time, date-time, or string is
expected here.
In the Report Designer use the Insert Line tool to draw the line where you want it to appear on your report. The right-click the line object and select "Format Line..." to open the Format Editor dialog box. On this window you will find a check box labeled "Suppress" with an X-2 button to the right. Click the X-2 button and this will open a Formula Workshop window where you will enter the formula that determines if this drawing object should be suppressed or not.
I would recommend the following formula based upon your previous attempts at creating one.
IF isNull({PrintParticularList.SLNO}) or {PrintParticularList.CUST_INVOICE_No}="" THEN
True
ELSE
False
-----EDIT-----
Since you don't have the X-2 button I have 2 more ideas.
1.) Take the 1 section you current have and split it into 3 sections. Then you could place all the content above the line in the first section, place the line in the second section, and the content below the line in the third section. They use the formula to suppress the second section when the line is not needed.
2.) Insert a blank text box in place of the line and set either the top or bottom border of the text box to a single line. Then use the suppress formula to determine if the text box should be shown or hidden.

Crystal report Header row Color

I want to color the header and footers row(only my data tables not the full section) of a crystal report . Its easy to color the section but i cannot able find a proper way
For this 3 way you achieve.
If both header/footer in different section than data, then go to section, right click on formating, give the color. Check this link
http://www.codeproject.com/Questions/56657/change-back-color-of-crystal-report
http://scn.sap.com/thread/1883125
Drag and drop and spread a crystal report field (like label) into entire length of row's width. Give the color formating by clicking on Right click -> format object -> color. Now your header/footer field which work as a column /summary get front of this above field.
You can give the color to all object and also do not give gap between them.
Step to color the object.
1. Select the items that you want to change, and select select Format, then select Format Text.
2. The Format Editor dialog box appears.
3. Select the Font tab.
4. Select the appropriate font, style, size, and color.

"can grow" proprity of a crystal report field doesn't push down lines correctly

In my CR report i wanted to draw a Table so i used : Lines & Boxes.
But some of my fields contains a lot of information, so i had to change the "Can Grow" propriety of certain field to True, now the fields can wrap to Multi lines, but they don't push down the lines.
IN THE IMAGE: The Highlighted (Green) line is the actual position of the line (you can see that it hasn't being pushed down), The red line shows the right position where it is suppose to be.
How can i make "Can Grow" propriety in crystal report pushes down the lines ?
i finally found the answer :
The Line needs to be placed in a different Detail Section.
You need to split the details section into two parts (Details Section a, and b), one that contains the Field and the other under contains the Line, this way doesn't matter how big is the upper one (The one containing the Text) the Section containing the line will always remain under.
Actually you can put the line on the same section instead of creating a different section just for the line.
What you need to do is the following
Right click > Format Line
Check "Move to Bottom of Section when Printing"
Then your line will always be pushed down to the bottom of the section if your field grows.

suppress line conditional in crystal report

I've a vertical line that i want to suppress with a condition.
Unfortunately I don't see the condition option by a line.
When I use an empty textbox, all the other text is moved down.
Is there conditional another suppress option for a line?
You can't conditionally suppress a line in CR. I know of two options to get around that:
Put the line in its own section and then conditionally suppress the section.
Put a textbox over the line and then conditionally format the background of the textbox by right-clicking on the textbox -> Format Field -> Border tab -> check Background check box -> click "x+2" box to enter conditional formula, The formula would be something like if condition then crWhite else NoColor, where crWhite will hide the line, NoColor will show it.
Simple way,
Insert Text object increase the length of the object as required.
Go to Format Object -> select border property and choose Top or bottom lines.
Put some text (like under score or space) for object text and minimize the width of the object so that you can't see the provided data to the object but still border appears as a line.
As it worked for me.
I found an alternative to suppressing a line object, think this might help
CrystalReport1 cr1 = new CrystalReport1();
(cr1.ReportDefinition.ReportObjects["line_object_name"] as LineObject).LineStyle = CrystalDecisions.Shared.LineStyle.NoLine;

How to draw a line above a picture?

How do you display a line above a picture in Crystal Reports? I'm currently using Crystal Reports 8.5.
I am using a jpeg image in the report, with an image header section set to “Underlay Following sections”.
I added another header above the image header section, drew the line, and then gave the option “underlay following sections”, but the line is not displaying above the picture.
How can I add a line that will display above the picture?
There's a developer-provided workaround here, using textboxes: http://scn.sap.com/thread/1916479
Insert a text object and enter nothing.
Change the size (the height matches the line width) and background (background color matches the line color).
Right click on the text object and select Move | To Front. And then the "line" will be on top of the picture.
Unforunately, using Crystal Reports 2008, this would only allow me to shrink the textbox to a certain height (0.042 inches), which was still too big for a 1-pixel line.
If I understand your question, you want to add a line to an image in Crystal Report. Unfortunately, you won't be able to do this with Crystal Reports. Your best option is simply to draw a line above the image. If there is an issue with placement of the line, add another section above the section that contains the image.
A little late response, but this CodeProject answer works. I had the same problem and this workaround did the trick. I quote the answer here.
Create 2 separate reports. The 1st report will be the main report and the 2nd will be a subreport.
Place all page headers and footers on the main report.
(Main Report)
Right click on the PageHeaderSection and insert section below.
On the new PageHeaderSection, insert the image(your watermark) and set the section to Underlay Following Sections.
(Subreport)
Go to your subreport and place your data and lines on it.
(Main Report)
Again, right click on the PageHeaderSection and insert section below.
On the new PageHeaderSection, right click, Insert->Subreport
Select Choose a Crystal Report in a project, then click the 2nd report you've created. Voila! The lines will be now on the top of the
image! Just be sure to remove the borders of your subreport.
an easy way I added a line is:
add a text box (length of the line you want)
right click -> format text
click on the tab border
select either top or bottom border, the line style etc etc
You can draw a line or a box to appear on top of images.
To do this:
1- Go to Report Options.
2- Check the option Draw Line And Box On Top, and click OK.
Now you can draw over the images.
I've never tried to do this before now, but it appears that the Z order functions (under the Move menu- to back, to front, etc...) are not available for lines or images and it appears that the image z order is always above the line even if you have multiple sections and use the "underlay following sections" option.
My answer is that this can not be done the way you are trying to do it, but what if you try another way.
EDIT:
I'm assuming that you are trying to create a strike through in the image in certain instances. Assuming that, you should be able to have 2 images (one normal and one with the line through it) that you should then be able to dynamically change based on you're criteria. You should be able to find many articles on dynamically changing the Crystal Report image. Hope this helps.
What worked for me was to create a subreport that essentially duplicates/replaces the Details. Then the usual process of putting the image in the page header and underlaying following sections. The subreport, including its lines, appear above the watermark for me, but please note I'm using Crystal XI.
If I understand your question correctly - In the header section, use the line tool to draw the line. It's in the CR Toolbox. Then drag your image after the line.