Wrap text on a cell on radgridview

9 posts, 0 answers
  1. ISB-developer
    ISB-developer avatar
    21 posts
    Member since:
    Jul 2011

    Posted 18 Oct 2011 Link to this post

    Hi,
    Where is the setting in radgridview for wrapping the text inside of the cells?
  2. Alexander
    Admin
    Alexander avatar
    306 posts

    Posted 20 Oct 2011 Link to this post

    Hello,

    Thank you for your question.

    The WrapText is a property of GridViewColumn:
    this.radGridView1.Columns[0].WrapText = true;

    Please review this help article for more details concerning RadGridView columns.

    I hope it helps.

    Best regards,
    Alexander
    the Telerik team

    Q2’11 SP1 of RadControls for WinForms is available for download (see what's new); also available is the Q3'11 Roadmap for Telerik Windows Forms controls.

  3. Rawad
    Rawad avatar
    23 posts
    Member since:
    Jan 2012

    Posted 26 Jun 2014 in reply to Alexander Link to this post

    Dear Alexander

    Can I wrapText  specific cells and not the column,  the posted above shows how to Wrap a column.
    What I need is to wrapText of specific cells or rows 

    In Microsoft Grid, we used:  Gridview.rows(1).cells(1).Style.WrapMode = DataGridViewTriState.True


    Thanks
  4. Rawad
    Rawad avatar
    23 posts
    Member since:
    Jan 2012

    Posted 26 Jun 2014 in reply to Alexander Link to this post

    Dear Alexander

    The posted above shows how to WrapText a column.
    Could we WrapText a specific Cell ?

    In Microsoft Grid, we use  Gridview.Rows(1).Cells(1).Style.WrapMode=DataGridViewTriState.True


    Thanks
  5. Stefan
    Admin
    Stefan avatar
    2908 posts

    Posted 26 Jun 2014 Link to this post

    Hi Rawad,

    Thank you for writing.

    You can use the CellFormatting event do achieve the desired functionality. Here is also a small sample:
    void radGridView1_CellFormatting(object sender, CellFormattingEventArgs e)
    {
        if (e.RowIndex == 1 && e.ColumnIndex == 1)
        {
            e.CellElement.TextWrap = true;
        }
        else
        {
            e.CellElement.ResetValue(LightVisualElement.TextWrapProperty, ValueResetFlags.Local);
        }
    }

    I hope this helps.

    Regards,
    Stefan
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  6. pabitra
    pabitra avatar
    3 posts
    Member since:
    Feb 2013

    Posted 12 Nov 2018 Link to this post

    Hi,

    I too facing  the same issue. while exporting the data from grid to excel i am using the below code...

    Dim spreadExporter As Telerik.WinControls.Export.GridViewSpreadExport = New Telerik.WinControls.Export.GridViewSpreadExport(griddata)

    ...............

    spreadExporter.ExportHierarchy = True
     spreadExporter.ExportVisualSettings = True

    If the column data is more i am not able to export. it is showing the error "code--2146233086:columnWidth should be greater or equal than 0 and less or equal than 2000."

    But if "spreadExporter.ExportVisualSettings = False" able to export but the excel format getting disturbed.

     

    Please suggest.

  7. Dimitar
    Admin
    Dimitar avatar
    2654 posts

    Posted 12 Nov 2018 Link to this post

    Hi,

    This seems to be a known issue and it is already logged in our Feedback Portal. The issue is fixed in the latest version. A workaround for previous versions is available here: UI for Winforms Feedback Portal - FIX. RadGridView - exception, when the grid has a column wider than 2000 and the grid, is exported.

    I hope this will be useful.

    Regards,
    Dimitar
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  8. pabitra
    pabitra avatar
    3 posts
    Member since:
    Feb 2013

    Posted 13 Nov 2018 in reply to Dimitar Link to this post

    Hi,

     Thanks for your above help .I use below code to fix the Grid Width and able to fix it.

    For Each col As GridViewDataColumn In gridview.Columns
    Dim xc As Integer = col.Index
                    Dim xcx As Double = col.Width
                   If (xcx > 2000) Then
                        col.Width = 2000

                        Dim vvv As String = col.WrapText
    .....
    But now I am getting Error of height "-2146233086-rowHeight should be greater or equal than 0 and less or equal than 600." I try to implement the same logic but in a single row each cell row height is different. And I am not able to track each cell row height. Only I am getting the standard row height. Please help to fix it .  

  9. Dimitar
    Admin
    Dimitar avatar
    2654 posts

    Posted 14 Nov 2018 Link to this post

    Hi Pabitra,

    For the row height, you can override the SetWorksheetRowHeight method and use the same approach.

    Let me know how this works for you.

    Regards,
    Dimitar
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top