0
我需要批量設置一組文檔的超鏈接基本屬性。我可以使用.net和OPEN XML打開docx,但是我在進行下一步操作時遇到問題,並正在更改正確的屬性。在下面的示例中,我得到了字符的數量,但不知道這是我應該遵循的路徑。如何使用VB.Net更改DOCX文檔中的HyperlinkBase屬性
Private Sub ListFiles(ByVal lst As ListBox, ByVal pattern As String, ByVal dir_info As DirectoryInfo)
' Get the files in this directory.
Dim fs_infos() As FileInfo = dir_info.GetFiles(pattern)
For Each fs_info As FileInfo In fs_infos
Dim xmlProperties As XmlDocument = New XmlDocument
Dim wordDoc As WordprocessingDocument = WordprocessingDocument.Open(fs_info.FullName, False)
Dim appPart As ExtendedFilePropertiesPart = wordDoc.ExtendedFilePropertiesPart
Dim props = wordDoc.PackageProperties
xmlProperties.Load(appPart.GetStream)
Dim chars As XmlNodeList = xmlProperties.GetElementsByTagName("Characters")
MessageBox.Show("Number of characters in the file = " + chars.Item(0).InnerText, "Character Count")
Next fs_info
fs_infos = Nothing
End Sub