Question

I have this so far:

Table table = CreateBaseTable();
Row row = table.AddRow();
    {
        row.Cells[0].AddParagraph().AddFormattedText(text, bold);
    }

I would like to have a line after this text, for example:

This Is a Header ------------------------------------------------------------------------------------ but not dotted.

Thanks

Was it helpful?

Solution

If you want a line to the right of your text: use a tab stop with a line as filling (that's how it looks like in your question but I presume this is not what you want).

If you want to have the line below the text: set the border of the table cell (or table row). In your case, set the bottom border width to the desired width, set the width of other borders (top, left, right) to 0.

For the row, try code like this:

row.Borders.Bottom.Visible = true;
row.Borders.Bottom.Width = 1;

Edit: Here's sample code for the tab stop:

paragraph = section.AddParagraph("Hello, World!");
paragraph.Format.TabStops.ClearAll();
paragraph.Format.TabStops.AddTabStop("16cm", TabAlignment.Right, TabLeader.Lines);
paragraph.AddTab();

I should have tested that before pointing that option out. The line is drawn at the base, so it looks like
The Header_____________________

TabLeader also offers Dashes (which you don't want) or MiddleDots (which you didn't ask for either). So I'm afraid there is no simple solution to get exactly what you want.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top