c# 在word插入横线
需引用
using Microsoft.Office.Interop.Word;
using MSWord= Microsoft.Office.Interop.Word;
# region 插入横线
public void InsertLine(Document wordDoc)
{
Paragraph p = wordDoc.Paragraphs.Add(ref oMissing);
p.Format.Alignment = WdParagraphAlignment.wdAlignParagraphCenter;
p.Format.Borders[MSWord.WdBorderType.wdBorderBottom].LineStyle = MSWord.WdLineStyle.wdLineStyleSingle;
}
#endregion
效果如图