Word table, inserting lines.

I am looping thru a rows of data and adding these lines of text to a table cell - full page width. When I see the doc the lines are there, but there are also 2 empty lines b/t each line of text. What do I need to set to keep these blank lines from showing up.

I am using this:

For Each event As XmlNode In xmlRep.SelectSingleNode("//Report").ChildNodes
        oDoc.Tables(1).Rows(3).Cells(1).Range.Text &= event.InnerText
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Alfred A.Commented:

I am not exactly sure if I understand what you want but you can check the event.InnerText if it has actual data or it is an empty string.

And if it is an empty string then, ignore event.InnerText.  This would avoid the having empty lines.  I hope this helps.
Hawkvalley1Author Commented:
That's the problem, there are no empty lines. That would have to easy. I believe it's a formatting problem.
Alfred A.Commented:

Have you tried removing control characters (e.g. carriage return and line feed)?  This might be the cause of the problem.

You can try doing this


The only problem with the code above is that it will remove the crlf of the valid lines.

Maybe, you can also inspect the length of the inner text and check if only control characters are in it.

I hope this gives you some idea. :-)
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

In Word, you can toggle the display of the formatting characters such as paragaph marks (¶) with the Show/Hide button.

You should then be able to look at the paragraph formatting to see if the extra lines are caused by the paragraph internal line spacing or between paragraphs (space before and/or space after). Unfortunately I can't tell you how to modify those settings in XML.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Hawkvalley1Author Commented:
I modified the Word template: Line Spacing = At Least, before and after set to 0 pts. The other thing is not to use a VBCRLF or Environment.Newline following each nodes innertext - somehow it returns to the next line with each loop anyway - strange behavior I think. Thanks Graham.
Hawkvalley1Author Commented:
Not sure why I didn't think of that. Sitting too close to the action I guess. Thanks again.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.