如何将datagrid数据导出到XML? [英] How do I export datagrid data to an XML?
问题描述
你好,
我有一个DataGrid,我想用自定义标签将其数据导出为XML。
例如,具有full-page-heading的行将具有< h1>< / h1>
标记,依此类推。我想要的是有条件标签。
请帮忙。
我尝试过:
现在没什么,因为我无法继续
Hello,
I have a DataGrid and I want to export its data into XML, with custom Tags.
For example, a row having "full-page-heading" will have a <h1></h1>
tag and so on. What I want is conditional tagging.
Please help.
What I have tried:
Nothing as of now as I am unable to proceed
推荐答案
您的DataGridView是否与数据源绑定?如果是,什么样的数据源:BindingSource,DataTable,DataSet?
Does your DataGridView is bind with datasource? If yes, what kind of datasource: BindingSource, DataTable, DataSet?
它是DataSet
It is DataSet
在这种情况下,最简单的方法是使用:DataSet.WriteXml Method(System.Data) [ ^ ]和 DataSet.ReadXml方法(System.Data) [ ^ ]
小型Google搜索会返回一堆示例。例如,看看
- [ ^ ]
- 将DataGridView导出到XML文件没有任何DataSet或DataTable ...... [ ^ ]
A small Google search returns a bunch of example. For example have a look at
- Export Data From Dategridview to XML file using C# - Stack Overflow[^]
- Export DataGridView to XML File without any DataSet or DataTable ...[^]
这篇关于如何将datagrid数据导出到XML?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!