“A generic error occurred in GDI+” while using MeasureString
|Product||Progress® Telerik® Reporting|
GDI+ error can occur when previewing a report if there is a report item (TextBox) containing a very long string (more than 32000 symbols).
"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.
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.