C# word remove extra spaces from table row RRS feed

  • Question

  • hi,

    i have a table with two rows.

    in de 2nd row i to put some text from xml file.

    the text in xml file is like this:

    <div><p>some text.  <br/>&#160;</p></div> (Exactly as i typed.)

    now when i insert this text in table row i see some extra empty lines in this row.

    i tried the following but it didn't help:

                    rang.Paragraphs.SpaceAfter = 0;
                    rang.Paragraphs.SpaceBefore = 0;

    any other solution?

    Friday, August 24, 2012 6:51 AM


  • Hi moonstarlight

    Could you please turn on the display of non-printing characters? That would be the "backwards P" button on the Home tab, Paragraph group.

    What kind of symbols do you see in the table cell when the non-printing characters are displayed? You should see dots between the words that represent spaces. And there will be a little "sunshine" at the end of the text that represents the end of the table cell.

    Do you see anything else? What I'm trying to find out is whether there might be other characters in the cell, or whether we're dealing only with paragraph formatting.

    Besides that, I recommend selecting the cell and looking at the Paragraph dialog box - where you also find SpaceAfter and SpaceBefore. What's the setting for Line Spacing? What is the font size applied to your text? Does it help at all to set the line spacing to an "exact" setting?

    Cindy Meister, VSTO/Word MVP

    Friday, August 24, 2012 2:09 PM