How to draw line or a separator?

Nov 25, 2014 at 11:53 AM
can anyone tell How to draw line or a separator?
Feb 4, 2015 at 5:50 AM
Unfortunately Line Drawing is NOT supported. However there are a couple of work arounds

1 Place a Tab where you want the line separator, see example below
// Create the document
Document document = new Document(@"C:\Word\Line.docx");
document.Append(new Paragraph("There is a line separator after this"));
Paragraph p = new Paragraph(); // Create a new Paragraph
// Workout the document width
int position =  Convert.ToInt32(document.PageWidth - document.LeftMargin - document.RightMargin);
// Add a tab stop to the paragraph a extreme right hand edge
p.AddTabStop(position, enumTabStops.Left, enumLeaderChar.Underscore);
// Add an actual Tab to the Paragraph
Run r = new Run(enumBreakValues.Tab);
document.Append(p); // add the Paragraph to the Document
document.Append(new Paragraph("There is a line separator before this"));
2 You could add a Table with 1 Cell and set its Background colour to whatever you like. Unfortunately you can set the Row height of a Table (available next release)
Table t = new Table(1, 1);
t.SetAllBorders(enumBorderValues.None);  // No borders
Cell c = t[0][0];
c.BackgroundColour = "FFFF00"; // yellow

// Save the Document