您可以参考下面的代码,head和footer是一样的操作
- _textControl.HeadersAndFooters.Add(HeaderFooterType.Header);
- HeaderFooter head = _textControl.HeadersAndFooters.GetItem(HeaderFooterType.Header);
- head.Activate();
- PageNumberField pnf = new PageNumberField(2, NumberFormat.ArabicNumbers);
- head.PageNumberFields.Add(pnf);
- head.Selection.Start = pnf.Length;
- head.Selection.Length = 0;
- head.Selection.Text = "dfdfdfdfdf";
- head.Selection.ParagraphFormat.Alignment = TXTextControl.HorizontalAlignment.Center;
- head.Deactivate();
复制代码 |