Ms word 上传的Word文档中的新行标记是什么?

Ms word 上传的Word文档中的新行标记是什么?,ms-word,Ms Word,我试图上传Word文档,然后用HTML逐行编写。我参考了Microsoft Word对象库。然后,我使用下面的代码获取并将其放入字符串变量中。但是,我尝试了多个正则表达式语句,用“”替换新行字符,但没有任何效果 Dim wordApp As New Microsoft.Office.Interop.Word.Application Dim wordDoc As New Microsoft.Office.Interop.Word.Document Dim file As

我试图上传Word文档,然后用HTML逐行编写。我参考了Microsoft Word对象库。然后,我使用下面的代码获取并将其放入字符串变量中。但是,我尝试了多个正则表达式语句,用“
”替换新行字符,但没有任何效果

    Dim wordApp As New Microsoft.Office.Interop.Word.Application
    Dim wordDoc As New Microsoft.Office.Interop.Word.Document

    Dim file As Object = "C:\test.doc"
    Dim nullobj As Object = System.Reflection.Missing.Value

    wordDoc = wordApp.Documents.Open(file, nullobj, nullobj, nullobj, nullobj, nullobj, nullobj, nullobj, nullobj, nullobj, nullobj, nullobj)

    Dim strArticle As String = wordDoc.Content.Text

    'It's not finding the new line marker here
    strArticle = Regex.Replace(strArticle, ControlChars.NewLine, "<BR>")
Dim wordApp作为新的Microsoft.Office.Interop.Word.Application
Dim wordDoc作为新的Microsoft.Office.Interop.Word.Document
Dim文件为Object=“C:\test.doc”
Dim nullobj As Object=System.Reflection.Missing.Value
wordDoc=wordApp.Documents.Open(文件,nullobj,nullobj,nullobj,nullobj,nullobj,nullobj,nullobj,nullobj,nullobj)
Dim strArticle作为字符串=wordDoc.Content.Text
在这里找不到新的线条标记
strArticle=Regex.Replace(strArticle,ControlChars.NewLine,“
”)
您是否尝试过使用回车代替换行符?不知道它是否有效,但我刚刚在notepad++中打开了一个.doc文件,这些行用一个回车符分隔,ControlChars.NewLine由\cr+0组成

strArticle = Regex.Replace(strArticle, ControlChars.Cr, "<BR>")
strArticle=Regex.Replace(strArticle,ControlChars.Cr,“
”)