使用 Open XML 过滤表列的内容
我需要使用 openxml sdk 过滤表列的内容(在 MS-word 文档中)。我可以使用 reference = tablerow.ElementAt
获取表列内容(作为字符串)
我需要做的是将列的内容拆分为多个字符串,例如: 列
abcd
efgh
我使用 reference = tablerow.ElementAt
在参考中获取 abcdefgh
我需要的是拆分 abcd
和efgh
转换成不同的字符串。
这是我正在使用的代码:
foreach (Table table in tables)
{
foreach (TableRow tablerow in table.Descendants<TableRow>())
{
reference = tablerow.ElementAt<OpenXmlElement>(0).InnerText
}
}
I need to filter contents of table column(in MS-word document) using openxml sdk. I am able get table column contents(as string) using reference = tablerow.ElementAt<OpenXmlElement>(0).InnerText
What I need to do is split the content of column into muliple strings for eg:
column
abcd
efgh
I am getting abcdefgh
in reference using reference = tablerow.ElementAt<OpenXmlElement>(0).InnerText
What I need is to split abcd
and efgh
into different strings.
This the piece of code which I am using:
foreach (Table table in tables)
{
foreach (TableRow tablerow in table.Descendants<TableRow>())
{
reference = tablerow.ElementAt<OpenXmlElement>(0).InnerText
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果我正确理解你的问题,你只想将字符串拆分为子字符串。您可以使用 substring 或 拆分
从 foreach 循环中获取的引用
字符串。If I understand your question correctly you just want to split up a string into substrings. You can do that by using substring or split on the
reference
string that you get from your foreach loop.