Completed
Last Updated: 22 Oct 2015 08:10 by ADMIN
ADMIN
Dess | Tech Support Engineer, Sr.
Created on: 20 Oct 2015 12:16
Category: GridView
Type: Bug Report
1
FIX. RadGridView - ArgumentException is thrown on a Windows 8 machine when printing RadGridView with a long string value loaded in a cell
To reproduce:

DataTable dt = new DataTable();
dt.Columns.Add("Id", typeof(int));
dt.Columns.Add("Name", typeof(string));
dt.Rows.Add(1, new string('G', 32001));
this.radGridView1.DataSource = dt;
this.radGridView1.PrintPreview();


Workaround:  this.radGridView1.PrintCellFormatting+=radGridView1_PrintCellFormatting;

 private void radGridView1_PrintCellFormatting(object sender, PrintCellFormattingEventArgs e)
        {
            e.PrintCell.Text = e.PrintCell.Text.Substring(0,Math.Min(e.PrintCell.Text.Length, 32000));
        }
(Total attached files size should be smaller than 20mb. Allowed extensions: .zip, .rar, .jpg, .png, .gif)
1 comment
ADMIN
Dess | Tech Support Engineer, Sr.
Posted on: 20 Oct 2015 12:19
Since Windows 8, Microsoft reduced the length of a string that can be measured/drawn with GDI+ to 32000 characters (from 65535 in prior Windows versions). More on the matter can be found in the following feedback item -  http://stackoverflow.com/questions/30556042/a-generic-error-occurred-in-gdi-while-using-measurestring