Edit this page

“A generic error occurred in GDI+” while using MeasureString

Environment

Product Progress® Telerik® Reporting

Description

GDI+ error can occur when previewing a report if there is a report item (TextBox) containing a very long string (more than 32000 symbols).

Solution

"A generic error occurred in GDI+" while using MeasureString is a bug introduced in Windows 8, as discussed in the referred Stackoverflow thread.

To overcome the problem with rendering very long text we strongly recommend to limit the string lengths of the incoming data to 32000 symbols. If this is not possible, consider the following workaround.

Suggested Workarounds

Instead of TextBox use a List data item with a single TextBox inside. The DataSource of the List can be an ObjectDataSource with a single string Field - the Text to be displayed.
The DataMember of the ObjectDataSource should return a single record when the Text is less than 32000 symbols.
When the Text length is in the interval (32000, 64000] symbols the Text should be split in two data records, and so on. This way the Text will be displayed in the appropriate number of TextBoxes (with less that 32000 symbols) depending on its length.

Is this article helpful? Yes / No
Thank you for your feedback!

Give article feedback

Tell us how we can improve this article

close
Dummy