如何使用开放XML导出列表 [英] How to use open XML to export list

查看:67
本文介绍了如何使用开放XML导出列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我正在使用此代码将数据添加到已关闭的xml中的行和列,如何在打开的xml中使用它



Hi,

I am using this Code to add data to row and column in closed xml ,how to use this in open xml

foreach (var header in dynamicHeaderList)
           {
               ws.Cell(rowID, column).Value = header;
               ws.Cell(rowID, column).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
               ws.Cell(rowID, column).Style.Fill.BackgroundColor = XLColor.FromArgb(204, 255, 204);
               ws.Cell(rowID, column).Style.Font.Bold = true;
               ws.Cell(rowID, column).Style.Border.OutsideBorder = XLBorderStyleValues.Hair;
               column++;
           }

推荐答案

我不确定你想在这里使用openxml。



要创建表,您需要使用Open xml SDK。 使用WordprocessingML表(Open XML SDK) [ ^ ]提供了从xml创建表的示例。



在数据库方面,Sql server OpenXml提供了一个XML文档的行集视图,因此您可以更快地解析xml并对记录进行处理。



例如,您可以读取xml并插入数据库。

不是逐行循环并逐个插入记录,而是可以批量插入1000条记录,减少对数据库的调用次数。



您还可以通过OpenXml运行选择查询。



要了解更多信息,请浏览 OPENXML(Transact-SQL) [ ^ ]。
I'm not sure how you want to use openxml here.

To create a table you will need to use the Open xml SDK. Working with WordprocessingML tables (Open XML SDK)[^] provides and example where a table is created from an xml.

On the database side, Sql server OpenXml provides a rowset view over an XML document so you can parse the xml faster and do stuff with the records.

For example, you can read an xml and insert into database.
Instead of looping row by row and inserting records one by one, you can bulk insert 1000 of records reducing as many number of calls to the database.

You can also run select queries over OpenXml.

To know more about it, go through OPENXML (Transact-SQL)[^].


这篇关于如何使用开放XML导出列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆