Menu

how to fit a report in a page

pm71
2014-11-29
2014-12-01
  • pm71

    pm71 - 2014-11-29

    Hi,
    I have to produce a report with some constraints: the paper already has an header (need to print just below it) and each page must contain a precise number of records.
    The report has a blank page header and its height should be modifiable trough my app in order to print the page correctly after the header.
    1) can I change the page header's height programmatically?
    2) is there a 'page break' method in order to jump to a new page after a number of records?
    3) can I disable text-wrap for TContainerField ? it can take more vertical space causing problems at the bottom of the page.

    I'm figuring a way to do it:
    1) change the property in the xml file before running the report.
    2) exec the report many times for each set of records I want in a page.
    3) cut the text in order to avoid the wrapping.

    Is there a less ugly way?
    many thanks
    pm

     
    • aliks-os

      aliks-os - 2014-11-29

      Hi

      I think already it is time to create discussion where users will describe the wishes :).

      1) Currently there are no possibility change the report's property programmatically, it is in the plane.
      2) Also as previous. But I have a question. I can set a property for MasterDataBand for example "Start new page after N records". Is it sence of your question?
      3) Currently for Container with type Text sets a:

      a) Qt::TextDontClip 0x0200 If it's impossible to stay within the given bounds, it prints outside.
      b) Qt::TextWordWrap 0x1000 Breaks lines at appropriate points, e.g. at word boundaries.

      I may make these two properties will be sets by the user, but default values as above.
      So we will have
      Clip/DontClip - default dont clip, any suggestion ???
      WordWrap/DontWrap - default wrap, any suggestion ???

      I not quite understand what you mean "2) exec the report many times for each set of records I want in a page.". Please clarify.

       
  • pm71

    pm71 - 2014-11-30

    to clarify point 2 (sorry for my bad English) say I have to print 100 records on 2 pages and I must be sure to print 50 records per page:

    //...
    
    connect(qrpt, &QtRPT::setValue, this, &Dlg::setValue);
    
    qrpt->recordCount << 50;
    
    //print first 50 records
    qrpt->printExec();
    
    //print last 50 records
    qrpt->printExec();
    

    Inside setValue I know which page I'm printing and the subset of records to print (page 1 records from 0 to 49, page 2 records from 50 to 99 ...).

    This is the workaround I'm figuring to simulate the 'Start new page after N records'.

    In the end, my wishes are:

    1) change report's properties programmatically
    2) a property "Start new page after N records". But please also let's discuss about a method "Start new page Now".
    3) properties Clip/DontClip WordWrap/DontWrap seem OK.

    let'a add another question:
    4) can I compile the report as resource in order to have the xml inside the exe?

    thanks
    pm

     
  • aliks-os

    aliks-os - 2014-12-01

    May be better for your need create a second page? And in fact you will have two reports in one.

    A property "Start new page after N records"...I think it is a not good idea as a possible situation when the height of field is different and may occur the clip or overlapping of the bands.

    4) yes, you may put xml as a resource. There are two functions
    bool loadReport(QString fileName);
    bool loadReport(QDomDocument xmlDoc);

    First one for loading report from file.
    Seconf one you may use for loading report from resource

     

Log in to post a comment.