This question is locked. New answers and comments are not allowed.
Hi ,
I have a grid and i'm exporting the records of which to an excel sheet with the following code....
I have a column which displays color in it's cell template and I need to export it's hexadecimal code to the excel sheet..
The code of the grid is as follows,
But when I export to excel, the color is beign displayed as taskstatus1, taskstatus15 and so on..
Is there any way to format this into a hexadecimal or an integer color code... ?
Thanks in Advance,
Ramya
I have a grid and i'm exporting the records of which to an excel sheet with the following code....
private void Export()
{
try
{
SaveFileDialog dialog = new SaveFileDialog();
dialog.DefaultExt = "xls";
dialog.Filter = String.Format("{1} files (*.{0})|*.{0}|All files (*.*)|*.*", "xls", "Excel");
dialog.FilterIndex = 1;
{
try
{
SaveFileDialog dialog = new SaveFileDialog();
dialog.DefaultExt = "xls";
dialog.Filter = String.Format("{1} files (*.{0})|*.{0}|All files (*.*)|*.*", "xls", "Excel");
dialog.FilterIndex = 1;
if (dialog.ShowDialog() == true)
{
using (Stream stream = dialog.OpenFile())
{
GridViewExportOptions exportOptions = new GridViewExportOptions();
exportOptions.Format = ExportFormat.Html;
exportOptions.ShowColumnHeaders = true;
exportOptions.ShowGroupFooters = true;
radGridViewTaskStatus.Export(stream, exportOptions);
}
}
}
catch (Exception ex)
{
throw ex;
}
}
I have a column which displays color in it's cell template and I need to export it's hexadecimal code to the excel sheet..
The code of the grid is as follows,
<telerik:RadGridView Name="radGridViewTaskStatus" telerik:StyleManager.Theme="Office_Blue" AutoGenerateColumns="False" IsReadOnly="True" RowHeight="17" ShowColumnFooters="True" FontSize="11" FontFamily="Arial" Margin="41,0,39,10" Grid.Row="2" VerticalAlignment="Top" AddingNewDataItem="radGridViewTaskStatus_AddingNewDataItem" ItemsSource="{Binding}" FieldFilterEditorCreated="radGridViewTaskStatus_FieldFilterEditorCreated" SelectionChanged="radGridViewTaskStatus_SelectionChanged" DataLoaded="radGridViewTaskStatus_DataLoaded"> <telerik:RadGridView.Columns> <telerik:GridViewDataColumn Header="Status" Width="*" IsReadOnly="True" DataMemberBinding="{Binding Path=Status,Mode=TwoWay,Converter={StaticResource TrimConverter}}"> <telerik:GridViewDataColumn.AggregateFunctions> <telerik:CountFunction Caption="Count: " /> </telerik:GridViewDataColumn.AggregateFunctions> </telerik:GridViewDataColumn> <telerik:GridViewDataColumn Header="Order" DataMemberBinding="{Binding Path=Order,Mode=TwoWay,Converter={StaticResource TrimConverter}}" /> <telerik:GridViewCheckBoxColumn Header="Complete" DataMemberBinding="{Binding Path=Complete,Mode=TwoWay,Converter={StaticResource YesNoStringToBooleanConverter}}" EditTriggers="CellClick" AutoSelectOnEdit="True" /> <telerik:GridViewDataColumn Header="Colour" Width="100"> <telerik:GridViewColumn.CellTemplate > <DataTemplate> <StackPanel Height="17" Background="{Binding Path=Colour,Mode=TwoWay,Converter={StaticResource IntegerToColourConverter}}" Width="Auto"> </StackPanel> </DataTemplate> </telerik:GridViewColumn.CellTemplate> <telerik:GridViewColumn.CellEditTemplate > <DataTemplate> <StackPanel Background="{Binding Path=Colour,Mode=TwoWay,Converter={StaticResource IntegerToColourConverter}}" Width="Auto"> <Button Width="Auto" Height="Auto" Content="..." Margin="2" Name="radBtnSetColor" Click="radBtnSetColor_Click" HorizontalAlignment="Right" ></Button> </StackPanel> </DataTemplate> </telerik:GridViewColumn.CellEditTemplate> </telerik:GridViewDataColumn> </telerik:RadGridView.Columns> </telerik:RadGridView>But when I export to excel, the color is beign displayed as taskstatus1, taskstatus15 and so on..
Is there any way to format this into a hexadecimal or an integer color code... ?
Thanks in Advance,
Ramya