How to create header in code

edited 11:15PM in FastReport Studio
Hello,

I tried to create a report in code as follows:

// Create report
report = new TfrxReportClass();

// Create page
IfrxReportPage page = report.CreateReportObject(
report as IfrxComponent,
typeof(IfrxReportPage).GUID,
"DemoPage") as IfrxReportPage;

// Create title and his memo
IfrxBand title = report.CreateReportObject(
page as IfrxComponent,
typeof(IfrxReportTitle).GUID,
"Report Title") as IfrxBand;
IfrxMemoView title_memo = report.CreateReportObject(
title as IfrxComponent,
typeof(IfrxMemoView).GUID,
"Title memo") as IfrxMemoView;

// Create DataBand
IfrxDataBand band = report.CreateReportObject(
page as IfrxComponent,
typeof(IfrxDataBand).GUID,
"MasterData2") as IfrxDataBand;

IfrxMemoView memo1 = report.CreateReportObject(
band as IfrxComponent,
typeof(IfrxMemoView).GUID,
"MemoView1") as IfrxMemoView;

IfrxMemoView memo2 = report.CreateReportObject(
band as IfrxComponent,
typeof(IfrxMemoView).GUID,
"MemoView2") as IfrxMemoView;

IfrxMemoView memo3 = report.CreateReportObject(
band as IfrxComponent,
typeof(IfrxMemoView).GUID,
"MemoView3") as IfrxMemoView;



But how could I be able to create the header for memo1, memo2 and memo3?

Thanks.


Comments

  • edited 11:15PM
    Use this code:
                // Create GroupHeader
                IfrxGroupHeader header = report.CreateReportObject(page as TfrxDispatchableComponent,
                    typeof(IfrxGroupHeader).GUID, "GroupHeader1") as IfrxGroupHeader;
                header.Condition = "DemoQuery.\"Common_Name\"";
                (header as IfrxComponent).Height = 32;
                IfrxMemoView memo4 = report.CreateReportObject(header as TfrxDispatchableComponent,
                    typeof(IfrxMemoView).GUID, "Memo4") as IfrxMemoView;
                (memo4 as IfrxComponent).Left = 5;
                (memo4 as IfrxComponent).Top = 5;
                (memo4 as IfrxComponent).Width = 460;
                (memo4 as IfrxComponent).Height = 22;
                memo4.Color = 0xAAAAAA;
                memo4.Memo = "[DemoQuery.\"Common_Name\"]";
    

Leave a Comment