نمایش نتایج 1 تا 4 از 4

نام تاپیک: Add کردن object های FastReport و Group ها در زمان runtime

  1. #1
    کاربر دائمی آواتار rezamahdizadeh
    تاریخ عضویت
    اسفند 1385
    محل زندگی
    تهران
    پست
    345

    Add کردن object های FastReport و Group ها در زمان runtime

    اگر بخواهیم هر چی که در زمان design time به رپورت خالی اضافه می کنیم با کدنویسی اضافه کنیم در FastReport چه کار باید کرد؟

  2. #2
    کاربر دائمی آواتار DataMaster
    تاریخ عضویت
    تیر 1382
    محل زندگی
    مشهد الرضا
    پست
    634
    چند روز پیش توی هلپ خود نرم افزار یه سری کد بود بگرد پیدا نکردی برات میذارم

  3. #3
    کاربر دائمی آواتار rezamahdizadeh
    تاریخ عضویت
    اسفند 1385
    محل زندگی
    تهران
    پست
    345
    نقل قول نوشته شده توسط DataMaster مشاهده تاپیک
    چند روز پیش توی هلپ خود نرم افزار یه سری کد بود بگرد پیدا نکردی برات میذارم
    ممنون اگر این کدها را در پاسخ بیاوری

  4. #4
    کاربر دائمی آواتار DataMaster
    تاریخ عضویت
    تیر 1382
    محل زندگی
    مشهد الرضا
    پست
    634

    Creating a report form from code
    Top Previous Next
    As a rule, you will create most reports using the designer. Nevertheless, in some cases (for example, when the report’s form is unknown) it is necessary to create a report manually, from code.



    To create a report manually, one should perform the following steps in order:

    - clear the report component

    - add data sources

    - add the "Data" page

    - add report’s page

    - add bands on a page

    - set bands’ properties, and then connect them to the data

    - add objects on each band

    - set objects’ properties, and then connect them to the data



    Let us examine creation of a simple report of the «list» type. Assume that we have the following components: frxReport1: TfrxReport and frxDBDataSet1: TfrxDBDataSet (the last one is connected to data from the DBDEMOS, the «Customer.db» table). Our report will contain one page with the «Report Title» and «Master Data» bands. On the «Report Title» band there will be an object with the "Hello FastReport!" text, and the «Master Data» one will contain an object with a link to the "CustNo" field.



    var

    DataPage: TfrxDataPage;

    Page: TfrxReportPage;

    Band: TfrxBand;

    DataBand: TfrxMasterData;

    Memo: TfrxMemoView;



    { clear a report }

    frxReport1.Clear;



    { add a dataset to the list of ones accessible for a report }

    frxReport1.DataSets.Add(frxDBDataSet1);



    { add the "Data" page }

    DataPage := TfrxDataPage.Create(frxReport1);



    { add a page }

    Page := TfrxReportPage.Create(frxReport1);

    { create a unique name }

    Page.CreateUniqueName;

    { set sizes of fields, paper and orientation by default }

    Page.SetDefaults;

    { modify paper’s orientation }

    Page.Orientation := poLandscape;



    { add a report title band}

    Band := TfrxReportTitle.Create(Page);

    Band.CreateUniqueName;

    { it is sufficient to set the «Top» coordinate and height for a band }

    { both coordinates are in pixels }

    Band.Top := 0;

    Band.Height := 20;



    { add an object to the report title band }

    Memo := TfrxMemoView.Create(Band);

    Memo.CreateUniqueName;

    Memo.Text := 'Hello FastReport!';

    Memo.Height := 20;

    { this object will be stretched according to band’s width }

    Memo.Align := baWidth;



    { add the masterdata band }

    DataBand := TfrxMasterData.Create(Page);

    DataBand.CreateUniqueName;

    DataBand.DataSet := frxDBDataSet1;

    { the Top coordinate should be greater than the previously added band’s top + height}

    DataBand.Top := 100;

    DataBand.Height := 20;



    { add an object on master data }

    Memo := TfrxMemoView.Create(DataBand);

    Memo.CreateUniqueName;

    { connect to data }

    Memo.DataSet := frxDBDataSet1;

    Memo.DataField := 'CustNo';

    Memo.SetBounds(0, 0, 100, 20);

    { adjust the text to the right object’s margin }

    Memo.HAlign := haRight;



    { show the report }

    frxReport1.ShowReport;





    Let us explain some details.



    All the data sources, which are to be used in the report, must be added to the list of data sources. In our case, this is performed using the «frxReport1.DataSets.Add(frxDBDataSet1)» line. Otherwise, a report will not work.



    The "Data" page is necessary for inserting internal datasets such as TfrxADOTable into the report. Such datasets can be placed only to the "Data" page.



    The call for Page.SetDefaults is not necessary, since in this case a page will have the À4 format and margins of 0 mm. SetDefaults sets 10mm margins and takes page size and alignment, which a printers have by default.



    While adding bands to a page, you should make sure they do not overlap each other. To perform this, it is sufficient to set the «Top» and «Height» coordinates. There is no point in modifying the «Left» and «Width» coordinates, since a band always has the width of the page, on which it is located (in case of vertical bands it's not true – you should set Left and Width properties and don't care about Top and Height). One should note, that the order of bands’ location on a page is of great importance. Always locate bands in the same way you would do it in the designer.



    Objects’ coordinates and sizes are set in pixels. Since the «Left,» «Top,» «Width,» and «Height» properties of all objects have the «Extended» type, you can point out non-integer values. The following constants are defined for converting pixels into centimeters and inches:



    fr01cm = 3.77953;

    fr1cm = 37.7953;

    fr01in = 9.6;

    fr1in = 96;



    For example, a band’s height equal to 5 mm can be set as follows:



    Band.Height := fr01cm * 5;

    Band.Height := fr1cm * 0.5;







تاپیک های مشابه

  1. پاسخ: 3
    آخرین پست: دوشنبه 20 آبان 1387, 12:00 عصر
  2. مشکل با Db Cross-Tab Object در FastReport
    نوشته شده توسط dkhatibi در بخش ابزارهای گزارش سازی در دلفی
    پاسخ: 0
    آخرین پست: دوشنبه 19 آذر 1386, 23:07 عصر
  3. Object reference not set to an instance of an object
    نوشته شده توسط almanden در بخش C#‎‎
    پاسخ: 9
    آخرین پست: سه شنبه 16 مرداد 1386, 19:53 عصر
  4. حرکت Object ها در زمان RunTime
    نوشته شده توسط سید مسعود موحد در بخش برنامه نویسی در Delphi
    پاسخ: 2
    آخرین پست: شنبه 08 اسفند 1383, 14:18 عصر
  5. مشکل عدم تغییر فونت در FastReport ، در حالت Runtime
    نوشته شده توسط Look in future در بخش ابزارهای گزارش سازی در دلفی
    پاسخ: 4
    آخرین پست: شنبه 16 خرداد 1383, 07:29 صبح

قوانین ایجاد تاپیک در تالار

  • شما نمی توانید تاپیک جدید ایجاد کنید
  • شما نمی توانید به تاپیک ها پاسخ دهید
  • شما نمی توانید ضمیمه ارسال کنید
  • شما نمی توانید پاسخ هایتان را ویرایش کنید
  •