PageInfoDataProviderBase.GetText(PrintingSystemBase, PageInfoTextBrickBase) Method
Enables you to obtain and customize the text of the Page Info control.
Namespace: DevExpress.XtraPrinting
Assembly: DevExpress.Printing.v24.1.Core.dll
NuGet Package: DevExpress.Printing.Core
Declaration
Parameters
Name | Type | Description |
---|---|---|
ps | PrintingSystemBase | A PrintingSystemBase object. |
brick | PageInfoTextBrickBase | A PageInfoTextBrickBase descendant. |
Returns
Type | Description |
---|---|
String | A String value. |
Remarks
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>";
}
}
See Also