Srinivasan
Top achievements
Rank 1
Srinivasan
asked on 19 Oct 2011, 11:17 AM
Hi,
When i export my grid to excel, the second column's content in the exported excel seems not to fit the column.
I tried exporting the same grid to html and found that it is assigning a width of 20px for that column.
Attached the image of an exported file. Please let me know how to fix this.
Regards
Srini
When i export my grid to excel, the second column's content in the exported excel seems not to fit the column.
I tried exporting the same grid to html and found that it is assigning a width of 20px for that column.
Attached the image of an exported file. Please let me know how to fix this.
Regards
Srini
3 Answers, 1 is accepted
0
Hello Srinivasan,
Didie
the Telerik team
I was not able to reproduce such an issue at my end. Is there something special for that column? How are your columns and the RadGridView defined?
I would be more helpful if I could reproduce this issue at my end. Could you please provide a detailed information about your scenario?
Didie
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
Srinivasan
Top achievements
Rank 1
answered on 20 Oct 2011, 10:49 AM
Hi,
In my developer machine it was exported fine. But in test server i have this problem.please find below the code i used,
.xaml.cs
String columnList = "LogDate,StudentName,Warning";
PrintHelper.Export(StudentsGrid, columnList);-- Studentsgrid denotes grid name.
.Xaml
<
telerikGrid:RadGridView
x:Name
=
"StudentsGrid"
Grid.Row
=
"4"
VerticalAlignment
=
"Stretch"
Margin
=
"0 0 0 0"
ShowGroupPanel
=
"False"
CanUserFreezeColumns
=
"False"
RowIndicatorVisibility
=
"Collapsed"
ItemsSource
=
"{Binding AdmissionStudentCollection,Mode=TwoWay}"
AutoGenerateColumns
=
"False"
CanUserDeleteRows
=
"False"
AlternateRowStyle
=
"{StaticResource UxGridViewRowStyle1}"
Style
=
"{StaticResource UxRadGridViewStyle1}"
HeaderRowStyle
=
"{StaticResource UxGridViewHeaderRowStyle}"
RowStyle
=
"{StaticResource UxGridViewRowStyle2}"
IsFilteringAllowed
=
"False"
CanUserReorderColumns
=
"False"
GridLinesVisibility
=
"None"
CanUserResizeColumns
=
"False"
ShowColumnFooters
=
"False"
BorderBrush
=
"#9E9E9E"
IsReadOnly
=
"True"
SelectionMode
=
"Multiple"
BorderThickness
=
"1"
ScrollViewer.VerticalScrollBarVisibility
=
"Auto"
uc:ColumnHiderBinder.ColumnList
=
"{Binding ColumnsToHide}"
>
<
telerikGrid:RadGridView.Columns
>
<
telerikGrid:GridViewSelectColumn
UniqueName
=
"GridViewSelectColumn"
Width
=
"10"
HeaderCellStyle
=
"{StaticResource UxGridViewHeaderCellStyle1}"
/>
<
telerikGrid:GridViewDataColumn
HeaderCellStyle
=
"{StaticResource UxGridViewHeaderCellStyle1}"
CellStyle
=
"{StaticResource CustomCellStyle}"
Header
=
"Log Date"
DataMemberBinding
=
"{Binding LogDate}"
UniqueName
=
"LogDate"
>
<
telerikGrid:GridViewDataColumn.CellTemplate
>
<
DataTemplate
>
<
TextBlock
Text
=
"{Binding LogDate}"
Style
=
"{StaticResource G1TextBlockStyle_Content}"
IsHitTestVisible
=
"False"
/>
</
DataTemplate
>
</
telerikGrid:GridViewDataColumn.CellTemplate
>
</
telerikGrid:GridViewDataColumn
>
<
telerikGrid:GridViewDataColumn
DataMemberBinding
=
"{Binding StudentName}"
Header
=
"StudentName"
UniqueName
=
"StudentName"
HeaderCellStyle
=
"{StaticResource UxGridViewHeaderCellStyle1}"
CellStyle
=
"{StaticResource UxGridViewCellStyleForC23}"
/>
<
telerikGrid:GridViewDataColumn
Header
=
"Student"
DataMemberBinding
=
"{Binding StudentNameSort}"
UniqueName
=
"Student"
HeaderCellStyle
=
"{StaticResource UxGridViewHeaderCellStyle1}"
CellStyle
=
"{StaticResource UxGridViewCellStyleForC23}"
>
<
telerikGrid:GridViewDataColumn.CellTemplate
>
<
DataTemplate
>
<
StackPanel
Orientation
=
"Vertical"
Margin
=
"2 0 2 0"
>
<
TextBlock
Text
=
"{Binding StudentName}"
Style
=
"{StaticResource G1TextBlockStyle_Content}"
/>
<
StackPanel
Orientation
=
"Horizontal"
>
<
TextBlock
Text
=
"{Binding Gender}"
Style
=
"{StaticResource G1TextBlockStyle_Content}"
/>
<
Line
X1
=
"0"
Y1
=
"3"
X2
=
"0"
Y2
=
"13"
Margin
=
"5,0,5,0"
Stroke
=
"Black"
StrokeThickness
=
"1"
VerticalAlignment
=
"Center"
/>
<
TextBlock
Text
=
"{Binding DateOfBirth, Converter={StaticResource DateFormatConverter}}"
Style
=
"{StaticResource G1TextBlockStyle_Content}"
/>
</
StackPanel
>
</
StackPanel
>
</
DataTemplate
>
</
telerikGrid:GridViewDataColumn.CellTemplate
>
</
telerikGrid:GridViewDataColumn
>
<
telerikGrid:GridViewDataColumn
HeaderCellStyle
=
"{StaticResource UxGridViewHeaderCellStyle1}"
CellStyle
=
"{StaticResource CustomCellStyle}"
Width
=
"*"
Header
=
"Warning"
DataMemberBinding
=
"{Binding WarningMsg}"
UniqueName
=
"Warning"
>
<
telerikGrid:GridViewDataColumn.CellTemplate
>
<
DataTemplate
>
<
Grid
>
<
TextBlock
Text
=
"{Binding WarningMsg}"
Style
=
"{StaticResource G1TextBlockStyle_Content}"
TextWrapping
=
"Wrap"
/>
</
Grid
>
</
DataTemplate
>
</
telerikGrid:GridViewDataColumn.CellTemplate
>
</
telerikGrid:GridViewDataColumn
>
</
telerikGrid:RadGridView.Columns
>
</
telerikGrid:RadGridView
>
0
Hello Srinivasan,
Didie
the Telerik team
If the GridView is in the VisualTree, then there should not be such a problem. I see that the other 2 columns have a CellTemplate defined. What about to define a CellTemplate for that column as well?
Didie
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>