【发布时间】:2015-10-23 07:26:05
【问题描述】:
请尝试具体回答我的问题,不要提供替代方法,因为我有一个非常具体的问题需要这种临时解决方案。非常感谢。
我的代码自动通过 VB.NET 打开 Word,打开文档,找到表格,转到单元格,将 cells.range.text 移动到字符串变量中,并在 For 循环中将位置 p 处的字符与 字符串。
我尝试过字符串: “^p”、“^013”、“U+00B6”
我的代码:
Dim nextString As String
'For each cell, extract the cell's text.
For p = 17 To word_Rng.Cells.Count
nextString = word_Rng.Cells(p).Range.Text
'For each text, search for structure.
For q = 0 To nextString.Length - 1
If (nextString.Substring(q, 1) = "U+00B6") Then
Exit For
End If
Next
Next
将单元格文本分配给字符串变量时是否会丢失结构数据。我过去曾在 VBA 中成功搜索过这样的格式标记。
【问题讨论】:
-
似乎 VB.NET 字符串不包括字符引用“00B6”,因此没有 Pilcrow。我可以将 Word.Document.table.cell.range.text 转换为另一种数据类型吗?
标签: vb.net ms-word automation office-interop paragraph