Inserting Graphics and Links in a Report
Posted by on 24 July 2015 05:37 PM
Inserting an Image into the Advanced Report Designer
To find out how to create an Image URL follow this link.
To find out why you should not insert pictures directly, read our article here.
To insert an Image please open a report from OUTREACH|IT.
Select the picture-box tool and open a window by clicking anywhere in the report.
When the picture box window is selected you will see a little blue arrow in the top right hand corner (marked yellow). In the menu you will then see, there is a field to insert an Image URL.
Copy and paste the URL here and the image will appear as soon as you click outside of the field.
In order for the e-mail systems to work in HTML format you need to insert the following script into Scripts:
Private Sub Picture_HtmlItemCreated(ByVal sender As Object, ByVal e As DevExpress.XtraReports.UI.HtmlEventArgs)
Above you see the scrip piece which needs to be inserted into Scripts in order for the receiving e-mail services to get information on what to do with the picture.
Back in your Designer View when you select the image box you created you will find the the menu change on the right. Scroll down to Behavior and then open scripts by clicking on the arrow.
As you will see, in the dropdown menu in the HTML item created box, Picture_HTMLItemCreated needs to be selected. By selecting it you have made sure that the image you inserted is connected to the HTML Tag and the image is readable.
You have now inserted an image to your report.
Inserting a URL into the Advanced Report Designer
If you would like to send out a news letter with "Read more" buttons, you have two options:
1. If you want to insert a URL to a Rich Text field, you need to place a Rich Text field (RTF) in your report. Select this window and load the text you would like to insert in the report. The Text needs to be in ***.rtf format so use WordPad to create and design the text. Any URLs you want to have in the text are to be set up before you insert the text into the RTF! This means you can add a hyperlink to your text, then copy-paste it into your RTF. The link will show up, but it will not work until you have added the following script block:
Private Sub Link_HtmlItemCreated(ByVal sender As Object, ByVal e As DevExpress.XtraReports.UI.HtmlEventArgs)
Dim s As String = "<a href='" & (CType(sender, XRControl)).Tag.ToString() & "'>" & (CType(sender, XRControl)).Text & "</a>"
e.ContentCell.InnerHtml = s
Then follow the same steps above to change the "Behaviour" and "Scripts" to Link_HTMLItemCreated.
The links will now show up in blue. This can not be changed since this happens when you transfer the text to the report, so it doesn't matter what color the text was before. Make sure the background is not blue as well and you should be fine.
2. If you want to insert a URL to a Label field, you need to place a Label field in your report. Double click the box and type the text you need. Then click outside the box to end typing mode, select the box with one click and then find the menu on the right - menu option "Navigation" Click on the box "Navigation URL" and insert the URL you would like the box to lead to.
BUT! Only the entire box can be used as a link and formatted with size and fonts as well as colors, not separate text blocks! - Use this option for buttons (e.g. Read more, send, accept, reply, sign up etc.)!