TextCenter は、ページの中央にカスタムのヘッダーまたはフッター テキストを表示する場合に使用します。
置換可能なエスケープ タグ: | |
---|---|
[Page #] | 現在のページ番号を挿入します。 |
[Date Printed] | 印刷操作が開始された日付を挿入します。 |
[User Name] | System.Environment.UserName から取得したユーザー名を挿入します。 |
[Time Printed] | 印刷操作が開始された時刻を挿入します。 |
Imports Infragistics.Shared Imports Infragistics.Win Imports Infragistics.Win.Printing ' the print document exposes a 'PrintColorStyle' although ' it is up to the implementation to honor this. the default ' appearances and pagesections will honor this setting Me.UltraPrintDocument1.PrintColorStyle = ColorRenderMode.GrayScale ' the header and footer can have text aligned within ' the section and can include replaceable tokens Me.UltraPrintDocument1.Header.TextLeft = "[User Name]" Me.UltraPrintDocument1.Header.TextCenter = Me.UltraPrintDocument1.DocumentName Me.UltraPrintDocument1.Header.TextRight = "[Date Printed]" ' the header is a derived page section and therefore ' can have a border and control over which sides render ' the border Me.UltraPrintDocument1.Header.BorderStyle = UIElementBorderStyle.Solid Me.UltraPrintDocument1.Header.BorderSides = Border3DSide.Bottom ' initialize the text that will appear in the footer. ' this can be replaceable tokens that will insert the ' time, page number, etc. Me.UltraPrintDocument1.Footer.TextLeft = "[Time Printed]" Me.UltraPrintDocument1.Footer.TextRight = "[Page #]" ' the height of the section will be calculated automatically ' based on the contents but may be explicitly controlled ' using the height property 'this.ultraPrintDocument1.Footer.Height ' the section text can be setup to switch on ' alternate pages Me.UltraPrintDocument1.Footer.ReverseTextOnEvenPages = True ' add extra space our the page body Me.UltraPrintDocument1.PageBody.Margins.Top = 5 Me.UltraPrintDocument1.PageBody.Margins.Bottom = 5 ' the page property is the section representing the ' entire renderable area of the page. you can assign ' a border around the margin area Me.UltraPrintDocument1.Page.BorderStyle = UIElementBorderStyle.Solid ' and then use the padding to provide space between the ' border and contents (header, footer, pagebody) Me.UltraPrintDocument1.Page.Padding.Left = 2 Me.UltraPrintDocument1.Page.Padding.Right = 2 Me.UltraPrintDocument1.Page.Padding.Top = 2 Me.UltraPrintDocument1.Page.Padding.Bottom = 2 ' the appearance of the page will affect only the page itself Me.UltraPrintDocument1.Page.Appearance.BorderColor = Color.Black ' the appearance property will affect all sections Me.UltraPrintDocument1.Appearance.ForeColor = Color.Black
using Infragistics.Shared; using Infragistics.Win; using Infragistics.Win.Printing; // the print document exposes a 'PrintColorStyle' although // it is up to the implementation to honor this. the default // appearances and pagesections will honor this setting this.ultraPrintDocument1.PrintColorStyle = ColorRenderMode.GrayScale; // the header and footer can have text aligned within // the section and can include replaceable tokens this.ultraPrintDocument1.Header.TextLeft = "[User Name]"; this.ultraPrintDocument1.Header.TextCenter = this.ultraPrintDocument1.DocumentName; this.ultraPrintDocument1.Header.TextRight = "[Date Printed]"; // the header is a derived page section and therefore // can have a border and control over which sides render // the border this.ultraPrintDocument1.Header.BorderStyle = UIElementBorderStyle.Solid; this.ultraPrintDocument1.Header.BorderSides = Border3DSide.Bottom; // initialize the text that will appear in the footer. // this can be replaceable tokens that will insert the // time, page number, etc. this.ultraPrintDocument1.Footer.TextLeft = "[Time Printed]"; this.ultraPrintDocument1.Footer.TextRight = "[Page #]"; // the height of the section will be calculated automatically // based on the contents but may be explicitly controlled // using the height property //this.ultraPrintDocument1.Footer.Height // the section text can be setup to switch on // alternate pages this.ultraPrintDocument1.Footer.ReverseTextOnEvenPages = true; // add extra space our the page body this.ultraPrintDocument1.PageBody.Margins.Top = 5; this.ultraPrintDocument1.PageBody.Margins.Bottom = 5; // the page property is the section representing the // entire renderable area of the page. you can assign // a border around the margin area this.ultraPrintDocument1.Page.BorderStyle = UIElementBorderStyle.Solid; // and then use the padding to provide space between the // border and contents (header, footer, pagebody) this.ultraPrintDocument1.Page.Padding.Left = 2; this.ultraPrintDocument1.Page.Padding.Right = 2; this.ultraPrintDocument1.Page.Padding.Top = 2; this.ultraPrintDocument1.Page.Padding.Bottom = 2; // the appearance of the page will affect only the page itself this.ultraPrintDocument1.Page.Appearance.BorderColor = Color.Black; // the appearance property will affect all sections this.ultraPrintDocument1.Appearance.ForeColor = Color.Black;