What is the new line marker in an uploaded Word doc?
Posted
by Donde
on Stack Overflow
See other posts from Stack Overflow
or by Donde
Published on 2009-08-26T17:19:45Z
Indexed on
2010/05/14
13:04 UTC
Read the original article
Hit count: 457
msword
I am attempting to uplaod a Word doc and then write it line by line in HTML. I made a referecne to the Microsoft Word Object Library. Then I use the following code to grab the and put it in a string variable. However, I have tried multiple regex statements to replace the new line character with "
" but nothing I have tried has worked...
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>")
© Stack Overflow or respective owner