Silverlight4使用radgridview读取导出CSV文件
来源:互联网 发布:学php需要掌握 编辑:程序博客网 时间:2024/05/22 14:09
导出CSV
private void btnInsert_Click(object sender, RoutedEventArgs e) { radGridView1.ToCsv(); string extension = "csv"; SaveFileDialog dialog = new SaveFileDialog() { DefaultExt = extension, Filter = String.Format("{1} files (*.{0})|*.{0}|All files (*.*)|*.*", extension, "CSV"), FilterIndex = 1 }; if (dialog.ShowDialog() == true) { using (Stream stream = dialog.OpenFile()) { radGridView1.Export(stream, new GridViewExportOptions() { Format = ExportFormat.Csv, ShowColumnHeaders = true, ShowColumnFooters = true, ShowGroupFooters = false, }); } } }读取CSV
private void btnInsert_Click_1(object sender, RoutedEventArgs e) { OpenFileDialog dlg = new OpenFileDialog() { Filter = "Csv Files (*.csv)|*.csv|All Files (*.*)|*.*", }; if (true == dlg.ShowDialog()) { //myList.DataContext = dlg.Files; FileInfo fi= dlg.File; if (fi != null) { using (Stream stream = fi.OpenRead()) { List<ClientMetricNodeIcon> metricNodeIcons=new List<ClientMetricNodeIcon>(); StreamReader fileReader = new StreamReader(stream); string strLine = ""; string[] tempString=new string[4]; while (strLine != null) { strLine = fileReader.ReadLine(); if (strLine != null && strLine.Length > 0) { //ls.Add(strLine.Split(',')); ClientMetricNodeIcon metricNode=new ClientMetricNodeIcon(); tempString=strLine.Split(','); metricNode.UserName = tempString[0]; metricNode.Regex = tempString[1]; try { metricNode.Type= Convert.ToInt16(tempString[2]); } catch(Exception err) { metricNode.Type = 0; } try { byte[] byteArry = new byte[0]; byteArry = System.Text.Encoding.UTF8.GetBytes(tempString[3]); //string str = System.Text.Encoding.UTF8.GetString(byteArry); metricNode.Icon = byteArry; } catch (Exception err) { } metricNodeIcons.Add(metricNode); } } fileReader.Close(); radGridView1.ItemsSource = metricNodeIcons; stream.Close(); } } } }
- Silverlight4使用radgridview读取导出CSV文件
- PHP 读取/导出 CSV文件
- 使用Python读取/导出(写入)CSV文件
- lua读取excel导出的csv文件
- Java读取CSV文件并导出
- 使用lua读取csv文件
- CSV读取解析,导出
- 使用PHP导入和导出CSV文件
- 使用PHP导入和导出CSV文件
- 使用PHP导入和导出CSV文件
- 使用PHP导入和导出CSV文件
- 使用PHP导入和导出CSV文件
- 使用PHP导入和导出CSV文件
- 使用PHP导入和导出CSV文件
- 使用PHP导入和导出CSV文件
- 使用PHP导入和导出CSV文件
- 使用PHP导入和导出CSV文件
- 使用PHP导入和导出CSV文件
- 别组的下位机---日期--时间设定--等等
- DB2 的 case when then else end 条件分支的处理
- 如何禁止Windows关机
- 可动态布局的Android抽屉之完整篇
- windows性能监视器常用计数器
- Silverlight4使用radgridview读取导出CSV文件
- XMLHttpRequest成员
- 数据库连接池1
- iphone ios 中监听、观察和通知的五种方法
- readyState
- 用apache的dbcp数据库缓冲池
- 关于flex事件的讲解
- STL容器
- 解决Ubuntu下adb不识别Android真机的问题