回复 1楼hptj的帖子
需要使用 hd.Deactivate() 切换操作区域到普通文本区域,设置方式如下:
- TXTextControl.Section currentSection = textControl1.Sections.GetItem();
- HeaderFooter hd = currentSection.HeadersAndFooters.GetItem(TXTextControl.HeaderFooterType.Header);
- hd.Activate();
- hd.Selection = new Selection(0, -1);
- hd.Selection.FontName = "宋体";
- hd.Deactivate();
- foreach (Table table in textControl1.Tables)
- {
- foreach (TableCell cell in table.Cells)
- {
- textControl1.Selection.Start = cell.Start;
- textControl1.Selection.Length = cell.Length;
- textControl1.Selection.FontName = "宋体";
- textControl1.Selection.Length = 0;
- }
- }
- this.textControl1.Save("demo1.pdf", TXTextControl.StreamType.AdobePDF);
复制代码 |