Print image on second page

Leo BidiLeo Bidi Montevideo, Uruguay
edited 7:11PM in FastReport VCL 5
Hi I need to print a dataset eligible by user which has an image field that may have data or not.

I was thinking in create a report with 2 pages in which the second page only header-master-footer bands with the image field on the master.

How can I make the report to print according to this:

- dataset contains text and image
print both pages with text in first page and image in second page

- dataset contains only text
print only first page with text fields

- dataset contains only image field
print only second page with image field.

Is this a good way to do this ??

Many thanks

Comments

  • edited 7:11PM
    Hello,

    You can use code like below :

    IF (<Company."logo"> <> '' and <Company."email"> <> '') THEN
    BEGIN
    page1.visible:=true;
    page2.visible:=true;
    END
    ELSE IF (<Company."email"> <> '') THEN
    BEGIN
    page1.visible:=true;
    page2.visible:=false;
    END
    ELSE IF (<Company."logo"> <> '') THEN
    BEGIN
    page1.visible:=false;
    page2.visible:=true;
    END
    END;

    you can use the code at onstartreport event.

    logo presents image and email presents text. (syntax may not be correct since i am not good in delphi)

    Regarsds
    Leo Bidi wrote: »
    Hi I need to print a dataset eligible by user which has an image field that may have data or not.

    I was thinking in create a report with 2 pages in which the second page only header-master-footer bands with the image field on the master.

    How can I make the report to print according to this:

    - dataset contains text and image
    print both pages with text in first page and image in second page

    - dataset contains only text
    print only first page with text fields

    - dataset contains only image field
    print only second page with image field.

    Is this a good way to do this ??

    Many thanks
  • Leo BidiLeo Bidi Montevideo, Uruguay
    edited 7:11PM
    boakoms wrote on Nov 27 2018, 03:27 AM:
    Hello,

    You can use code like below :

    IF (<Company."logo"> <> '' and <Company."email"> <> '') THEN
    BEGIN
    page1.visible:=true;
    page2.visible:=true;
    END
    ELSE IF (<Company."email"> <> '') THEN
    BEGIN
    page1.visible:=true;
    page2.visible:=false;
    END
    ELSE IF (<Company."logo"> <> '') THEN
    BEGIN
    page1.visible:=false;
    page2.visible:=true;
    END
    END;

    you can use the code at onstartreport event.

    logo presents image and email presents text. (syntax may not be correct since i am not good in delphi)

    Regarsds


    Thank you boakoms... will try it and comment ..

    Regards
  • Leo BidiLeo Bidi Montevideo, Uruguay
    edited 7:11PM
    Hi, I am having trouble to print the report my client needs.

    I will try to explain my problem better.

    The dataset contains text , number and one image datafields .

    The user has the choice to select what records wants to print.

    If the users only selects the record with image field, the report must contains onley one page, with report title, header, masterband, detaildata ( contains the image field ) and footer bands.

    If the user choose not to print the record with the image fields, all rest must be printed with same bands as before but another data.

    Otherwise the user can choose to print all, in this case I need to force the image field be printed on the second page and alone.

    I've created a report with two pages almost identicals, but only the image field in the detail band of the second page.

    I am not sure if this report's desing its correct or do I need to also put the image field in the first page and hide if its empty and it what event
    must as hide it [img]style_emoticons/<#EMO_DIR#>/huh.gif" style="vertical-align:middle" emoid=":huh:" border="0" alt="huh.gif" /> Any help would be very apreciatte.. Thanks a lot !![/img]
  • edited November 2018
    Hello Leo,

    You can use Dialog Page to user select what he wants to see on report. For that go to File > New Dialog Page.

    In dialog page you can use controls to user select what he wants to print on the report.

    For example you can use combobox and fill it's itemindex like Print Text, Print Text & Image , Print Image Only.
    Or you can use Checkbox control with text next to it and give options to user what the wants to print.

    Then at events like onstartreport you can choose what will be visilbe and whats not like :


    if combobox1.value='Print Text' then page1.visible=true etc.
    if combobox1.value='Print Text & Image' then page2.visible=true page1.visible=false etc.
    if combobox1.value='Print Text' then page1.visible etc.
    or for checkbox :

    chkbox1 Print Text
    chkbox2 Print Data & Image
    chkbox3 Print Image

    After that you can show or hide the pages or databans according to the user choice in the code section like :

    if chkbox1.checked then page1.visible=true; or if chckbox1.checked then masterdata3.visible=true;

    since i dont know what you need exactly the easiest way seems like you have 3 pages.

    1 page data only with text.
    2 page data with text and image.
    3 page data with only

    but i am confused by that 'If the user choose not to print the record with the image fields, all rest must be printed with same bands as before but another data'

    if you need another datasource, you need to change the data source in the code or create another page with different data.

    Hope this helps,
    Regads.


    Leo Bidi wrote: »
    Hi, I am having trouble to print the report my client needs.

    I will try to explain my problem better.

    The dataset contains text , number and one image datafields .

    The user has the choice to select what records wants to print.

    If the users only selects the record with image field, the report must contains onley one page, with report title, header, masterband, detaildata ( contains the image field ) and footer bands.

    If the user choose not to print the record with the image fields, all rest must be printed with same bands as before but another data.

    Otherwise the user can choose to print all, in this case I need to force the image field be printed on the second page and alone.

    I've created a report with two pages almost identicals, but only the image field in the detail band of the second page.

    I am not sure if this report's desing its correct or do I need to also put the image field in the first page and hide if its empty and it what event
    must as hide it [img]style_emoticons/<#EMO_DIR#>/huh.gif" style="vertical-align:middle" emoid=":huh:" border="0" alt="huh.gif" /> Any help would be very apreciatte.. Thanks a lot !![/img]

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.