回复 1楼远光软件的帖子
通过以下代码可以正常在页面中插入文字:
- private void addHeaderToolStripMenuItem_Click(object sender, EventArgs e)
- {
- HeaderFooterCollection hfc = textControl1.Sections.GetItem().HeadersAndFooters;
- hfc.Add(HeaderFooterType.Header);
- HeaderFooter h = hfc.GetItem(HeaderFooterType.Header);
- if (h != null)
- {
- h.Selection.Text = "页码前 of 页码后";
- h.Selection.Start = 5;
- h.Selection.Length = 0;
- PageNumberField page = new PageNumberField(1, NumberFormat.ArabicNumbers);
- page.Editable = false;
- page.DoubledInputPosition = true;
- h.PageNumberFields.Add(page);
- h.Selection.Start = 8;
- h.Selection.Length = 0;
- PageNumberField totalPages = new PageNumberField();
- totalPages.Editable = false;
- totalPages.DoubledInputPosition = true;
- totalPages.ShowNumberOfPages = true;
- h.PageNumberFields.Add(totalPages);
- }
- }
复制代码 |