This is a migrated thread and some comments may be shown as answers.

Wrap text on a cell on radgridview

8 Answers 1836 Views
GridView
This is a migrated thread and some comments may be shown as answers.
ISB-developer
Top achievements
Rank 2
ISB-developer asked on 18 Oct 2011, 07:13 AM
Hi,
Where is the setting in radgridview for wrapping the text inside of the cells?

8 Answers, 1 is accepted

Sort by
0
Alexander
Telerik team
answered on 20 Oct 2011, 09:26 AM
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.

0
Rawad
Top achievements
Rank 2
answered on 26 Jun 2014, 12:25 PM
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
0
Rawad
Top achievements
Rank 2
answered on 26 Jun 2014, 12:26 PM
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
0
Stefan
Telerik team
answered on 26 Jun 2014, 01:23 PM
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.
 
0
pabitra
Top achievements
Rank 1
answered on 12 Nov 2018, 07:00 AM

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.

0
Dimitar
Telerik team
answered on 12 Nov 2018, 09:54 AM
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 and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
pabitra
Top achievements
Rank 1
answered on 14 Nov 2018, 05:21 AM

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 .  

0
Dimitar
Telerik team
answered on 14 Nov 2018, 10:23 AM
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 and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
GridView
Asked by
ISB-developer
Top achievements
Rank 2
Answers by
Alexander
Telerik team
Rawad
Top achievements
Rank 2
Stefan
Telerik team
pabitra
Top achievements
Rank 1
Dimitar
Telerik team
Share this question
or