corelibraries-devexpress-dot-xtraprinting-dot-pageinfodataproviderbase-dot-gettext-x28-devexpress-dot-xtraprinting-dot-printingsystembase-devexpress-dot-xtraprinting-dot-pageinfotextbrickbase-x29.md
Enables you to obtain and customize the text of the Page Info control.
Namespace : DevExpress.XtraPrinting
Assembly : DevExpress.Printing.v25.2.Core.dll
NuGet Package : DevExpress.Printing.Core
public abstract string GetText(
PrintingSystemBase ps,
PageInfoTextBrickBase brick
)
Public MustOverride Function GetText(
ps As PrintingSystemBase,
brick As PageInfoTextBrickBase
) As String
| Name | Type | Description |
|---|---|---|
| ps | PrintingSystemBase |
A PrintingSystemBase object.
| | brick | PageInfoTextBrickBase |
A PageInfoTextBrickBase descendant.
|
| Type | Description |
|---|---|
| String |
A String value.
|
In the following example, all PageInfo bricks are processed using the PageInfoDataProviderBase class. The GetText method returns information about the current HttpContext user.
using System.Web;
using DevExpress.XtraPrinting;
class CustomPageInfoDataProvider : PageInfoDataProviderBase
{
readonly HttpContext httpContext;
public CustomPageInfoDataProvider(HttpContext httpContext)
{
this.httpContext = httpContext;
}
public override string GetText(PrintingSystemBase ps, PageInfoTextBrickBase brick)
{
if (brick.PageInfo != PageInfo.UserName)
{
return null;
}
if (httpContext == null)
return "<No Information>";
var user = httpContext.User;
if (user == null || user.Identity == null)
return "<Please enable Forms or Windows security>";
var identity = user.Identity;
return identity.IsAuthenticated
? identity.Name
: "<Guest>";
}
}
Imports DevExpress.XtraPrinting
Friend Class CustomPageInfoDataProvider
Inherits PageInfoDataProviderBase
Private ReadOnly httpContext As HttpContext
Public Sub New(ByVal httpContext As HttpContext)
Me.httpContext = httpContext
End Sub
Public Overrides Function GetText(ByVal ps As PrintingSystemBase,
ByVal brick As PageInfoTextBrickBase) As String
If brick.PageInfo <> PageInfo.UserName Then
Return Nothing
End If
If httpContext Is Nothing Then
Return "<No Information>"
End If
Dim user = httpContext.User
If user Is Nothing OrElse user.Identity Is Nothing Then
Return "<Please enable Forms or Windows security>"
End If
Dim identity = user.Identity
Return If(identity.IsAuthenticated, identity.Name, "<Guest>")
End Function
End Class
View Example: How to Display the Name of the Current Logged in User in a Report
See Also
PageInfoDataProviderBase Class