Telefon DE: +49-8282-800-400 Telefon AT: +43-7322-370-202 Telefon CH: +41-41-5210-100

Report Designer – Script triggers an error

When you are editing the script, please use the template and just exchange the Name and size values.

This is a new script which is more user-friendly. If you use this script then there is no need to edit this script. For editing the size you can adjust it in the designer properties with „size“. Please ensure that you keep the proportion of the original picture when you change the size.

Private Sub Picture_HtmlItemCreated(ByVal sender As Object, ByVal e As DevExpress.XtraReports.UI.HtmlEventArgs)
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

Delete the current scripts and exchange them with the script above. Define the new script for the object and try it again.

If the error keeps showing up, please ensure that the „Script language“ is set to „visual basics“.

Please open a support ticket and attach the screenshot of the error if the error continues to show up. We will try to resolve your problem as soon as possible.



(For Staff:) The following line can be used to check the converted size. We recommend you not to use this line.

Copy the line and paste the script below „End Select“. Change to HTML-View to monitor the converted size. It will be shown in windows Pop-ups.

System.Windows.Forms.MessageBox.Show(„controlSize.Height “ & controlSize.Height & “ controlSize.Width “ & controlSize.Width & “ ~ convertedSizeHeight: “ & convertedSizeH & “ convertedSizeWidth: “ & convertedSizeW )