Last post May 28, 2011 07:32 AM by Andrew Morton
May 26, 2011 07:52 AM|vpatelintrack|LINK
I am generating report in word(i.e) I am exporting all the data from the database and replacing it in with the placeholder in the word document.
While the data is being retrieved from the database if the data contains any enter or new line character it retrieves it with the boxes and hence it replaces the string in the word with boxes such as for eg. abc and then box icon and then xyz on other line
text.how can i eliminate the box icon and still display the data as above?
I have tried replacing the character using chr(11), chr(13), system.newline etc but the box icon still exists? Is there any other way i can perform the above task?
May 28, 2011 07:32 AM|Andrew Morton|LINK
You can remove all the chr(13) and chr(11) using a regular expression replacement:
Dim s = "abc" & vbCrLf & "def"
Dim t = Regex.Replace(s, "[\r\n]", "")
- t now contains "abcdef" with no extra characters.
(You'll need Imports System.Text.RegularExpressions)