/// <summary> /// 设置表格的单元格的对齐方式 /// </summary> /// <param name="table">表格对象索引</param> /// <param name="rowIndex">行号</param> /// <param name="clumnIndex">列号</param> /// <param name="align">水平对齐方式</param> /// <param name="valign">垂直对齐方式</param> public void SetTableCellAlignment(int table, int rowIndex, int clumnIndex, Word_Alignment align, Word_Alignment valign) { this.WordApp.ActiveDocument.Tables[table].Cell(rowIndex, clumnIndex).Select(); this.WordApp.ActiveDocument.Tables[table].Cell(rowIndex, clumnIndex).VerticalAlignment = (WdCellVerticalAlignment)valign; this.WordApp.Selection.ParagraphFormat.Alignment = (WdParagraphAlignment)align; }
/// <summary> /// 设置段落对齐方式 /// </summary> /// <param name="paragraph">段落</param> /// <param name="alignment">对齐方式</param> public void SetAlignment(Paragraph paragraph, Word_Alignment alignment) { paragraph.Alignment = (WdParagraphAlignment)alignment; }