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
Next
LVL 9
Hawkvalley1Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
GrahamSkanConnect With a Mentor RetiredCommented:
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.
0
 
Alfred A.Commented:
Hi,

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.
0
 
Hawkvalley1Author Commented:
That's the problem, there are no empty lines. That would have to easy. I believe it's a formatting problem.
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
Alfred A.Commented:
Hi,

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

event.InnerText.Replace(vbcrlf,"")

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. :-)
0
 
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.
0
 
Hawkvalley1Author Commented:
Not sure why I didn't think of that. Sitting too close to the action I guess. Thanks again.
0
All Courses

From novice to tech pro — start learning today.