This project has moved and is read-only. For the latest updates, please go here.

Unwanted Line Feed

May 1, 2014 at 11:42 PM
Edited May 1, 2014 at 11:43 PM
When I use the following code to fill a cell in a table the cell is filled properly:
But, if PrintLine = "President" I get an unwanted line feed after the word "President" with the following code:
How can I prevent the unwanted line feed?
May 2, 2014 at 11:16 AM
Not quite sure if I really understand what's going on here, sounds to me as if it's not really DocX related..?

I'm not really familiar with PrintLine, but it seems to me as if that's something that would add a line feed to ensure you are printing multiple lines instead of just one.

Does it work if you replace any line feed characters in PrintLine with an empty string?
Something like:
t.rows(1).cells(0).Paragraphs(0).Append(PrintLine.Replace(vbCr, "").Replace(vbLf, ""))
May 2, 2014 at 1:47 PM
I should have included the Dim statement for PrintLine. It is a string variable. Well, it appears that it is not related to using a string variable at all. A line feed is generated whenever I merge cells. There are three rows with merged cells. When they are not merged, no line feed is generated. When I put the merge statement in, either before or after the append statement, a line feed is generated. So now I have to look elsewhere. Thanks for your help.
May 2, 2014 at 1:55 PM
This problem has been noted before. Several possible solutions are at:
Marked as answer by rkulp on 5/2/2014 at 5:59 AM