Hello,
I am using RadControls_for_WPF35_2010_2_0812_DEV,
When I create a analysis in our solution, i can not exporting this analysis with umlaut letters (Ä,Ü,ß etc.) to excel, html.
Could you help me to fix the problem?
We uses your Export Excel Snippet of your WPF Demo.
Best regards,
Michael
I am using RadControls_for_WPF35_2010_2_0812_DEV,
When I create a analysis in our solution, i can not exporting this analysis with umlaut letters (Ä,Ü,ß etc.) to excel, html.
Could you help me to fix the problem?
We uses your Export Excel Snippet of your WPF Demo.
#region Export2Excelprivate byte groupCount = 0;private void RadButton_Click(object sender, RoutedEventArgs e){ groupCount = 1; string extension = "xls"; string extension2 = "html"; var format = ExportFormat.Html; SaveFileDialog dialog = new SaveFileDialog(); dialog.DefaultExt = extension; dialog.Filter = String.Format("{1} files (*.{0})|*.{0}|{3} files (*.{2})|*.{2}", extension, "Excel", extension2, "HTML"); dialog.FilterIndex = 1; if (dialog.ShowDialog() == true) { if (dialog.FilterIndex == 1) { using (Stream stream = dialog.OpenFile()) { GridViewExportOptions exportOptions = new GridViewExportOptions(); exportOptions.Format = format; exportOptions.ShowColumnFooters = true; exportOptions.ShowColumnHeaders = true; exportOptions.ShowGroupFooters = true; RadGridView1.Export(stream, exportOptions); } } else { var str = RadGridView1.ToHtml(true, true); var f = File.CreateText(dialog.FileName); f.Write(str); f.Close(); } }}private void RadGridView1_ElementExporting(object sender, GridViewElementExportingEventArgs e){ byte faktor = 10; Color groupBGCol = Colors.DarkGray; if (e.Element == ExportElement.HeaderRow || e.Element == ExportElement.FooterRow) { e.Background = Colors.DarkGray; e.Foreground = Colors.Black; e.FontSize = 20; e.FontWeight = FontWeights.Bold; } else if (e.Element == ExportElement.GroupFooterRow) { groupCount--; groupBGCol.R += Convert.ToByte(groupCount * faktor); groupBGCol.G += Convert.ToByte(groupCount * faktor); groupBGCol.B += Convert.ToByte(groupCount * faktor); e.Background = groupBGCol; e.Foreground = Colors.Black; e.FontSize = 20; e.FontWeight = FontWeights.Bold; } else if (e.Element == ExportElement.Row) { e.Background = Colors.LightGray; e.Foreground = Colors.Black; } else if (e.Element == ExportElement.Cell && e.Value != null && e.Value.Equals("Chocolade")) { e.FontFamily = new FontFamily("Verdana"); e.Background = Colors.LightGray; e.Foreground = Colors.Blue; } else if (e.Element == ExportElement.GroupHeaderRow) { groupCount++; groupBGCol.R += Convert.ToByte(groupCount * faktor); groupBGCol.G += Convert.ToByte(groupCount * faktor); groupBGCol.B += Convert.ToByte(groupCount * faktor); e.FontFamily = new FontFamily("Verdana"); e.Background = groupBGCol; e.Height = 30; } else if (e.Element == ExportElement.GroupHeaderCell && e.Value != null && e.Value.Equals("Chocolade")) { e.Value = "MyNewValue"; } else if (e.Element == ExportElement.GroupFooterCell) { GridViewDataColumn column = e.Context as GridViewDataColumn; QueryableCollectionViewGroup qcvGroup = e.Value as QueryableCollectionViewGroup; if (column != null && qcvGroup != null && column.AggregateFunctions.Count() > 0) { e.Value = GetAggregates(qcvGroup, column); } else e.Value = string.Empty; } if (e.Value != null) { DateTime tmp; if (DateTime.TryParse(e.Value.ToString(), out tmp)) { e.Value = tmp.ToShortDateString(); } }}Best regards,
Michael
