Report Designer – Causes for Gaps
Customers reported gaps between objects in Report Designer when they switched to the HTML-View. We have tried to reproduce this situation.
We mainly had the problem when we tried to put a picture box beside a RTF-Object. In many cases it leds to a gap of 2-3 cm.
To fix this issue (1) please check if there are any blank lines at the end of the RTF-document.
(2) When you use scripts for the picture box then ensure that the size of the drawn object is a bit bigger or at least has the same size than the size of the script. Just a calculated example: The value in script: 20X20. The size of the drawn square: 15X15. –> This example could lead to gaps. To fix it try to exchange the values: Script: 20X20. Square: >=20 for example 21X21. –> Now the gap shouldnt be as big as before. The pictrue will still have 20X20 because the script dominates. Caution! This is just an example to explain the problem. The size values and script values have different semantics so you have to guess the size of the drawn object.
(3) Also check if there are any active size scripts for the other objects.
(4) Gaps in Outreach can also happen by a mistake of the HTML-View. To exclude this approach, please send a test E-Mail to check if the gap is shown in the used E-Mail application. Every application uses his own HTML-Language. You will probably have to choose one application to optimize the E-mail for.
UPDATE: We have now developed a more user-friendly script. To exclude (2) exchange the script you are using with the script below.
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. Please remember to change the scripts of your objects to „Picture_HtmlItemCreated“.
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
convertedSizeW = GraphicsUnitConverter.Convert(controlSize, GraphicsUnit.Document, GraphicsUnit.Inch).Width / 100
convertedSizeH = GraphicsUnitConverter.Convert(controlSize, GraphicsUnit.Document, GraphicsUnit.Inch).Height / 100
convertedSizeW = GraphicsUnitConverter.Convert(controlSize, GraphicsUnit.Document, GraphicsUnit.Millimeter).Width * 4.4776119
convertedSizeH = GraphicsUnitConverter.Convert(controlSize, GraphicsUnit.Document, GraphicsUnit.Millimeter).Height * 4.4776119
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
(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)<