Please contact us if you don't yet have an account for our ticket system, we'll create it for you.

UK: +44 203 86825-78
Australia: +61 879 0571-13
USA: +1 208 56192-34
D-A-CH: +49 8282 800400
E-Mail: info@crmaddon.com




 
 Knowledgebase
Knowledgebase
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. 

Choose picture box and open a window

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)
e.ContentCell.Controls.Clear()
Dim convertedSizeW as Integer
Dim convertedSizeH as Integer
Dim controlSize as Size = CType(sender, XRControl).Size
Select Case xtraReport1.ReportUnit
Case ReportUnit.HundredthsOfAnInch
convertedSizeW = GraphicsUnitConverter.Convert(controlSize, GraphicsUnit.Document, GraphicsUnit.Inch).Width / 100
convertedSizeH = GraphicsUnitConverter.Convert(controlSize, GraphicsUnit.Document, GraphicsUnit.Inch).Height / 100
Case ReportUnit.Pixels
convertedSizeW = GraphicsUnitConverter.Convert(controlSize, GraphicsUnit.Document, GraphicsUnit.Pixel).Width * 3.14
convertedSizeH = GraphicsUnitConverter.Convert(controlSize, GraphicsUnit.Document, GraphicsUnit.Pixel).Height * 3.14

Case ReportUnit.TenthsOfAMillimeter
convertedSizeW = GraphicsUnitConverter.Convert(controlSize, GraphicsUnit.Document, GraphicsUnit.Millimeter).Width * 4.4776119
convertedSizeH = GraphicsUnitConverter.Convert(controlSize, GraphicsUnit.Document, GraphicsUnit.Millimeter).Height * 4.4776119
End Select
Dim s As String = "<a href='" & (CType(sender, XRControl)).Tag.ToString() & "'>" & "<img src='" & (CType(sender, XRPictureBox)).ImageUrl.ToString() & "' width='" & convertedSizeW & "' height='" & convertedSizeH & "' border='0'>" & "</a>"
e.ContentCell.InnerHtml = s
End Sub

_________________________________________________________________________________________

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)

     e.ContentCell.Controls.Clear()

     Dim s As String = "<a href='" & (CType(sender, XRControl)).Tag.ToString() & "'>" & (CType(sender, XRControl)).Text & "</a>"

     e.ContentCell.InnerHtml = s

End Sub

 

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.)!


Comments (0)