about general report function

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • linbl352
    New Member
    • Apr 2006
    • 9

    about general report function

    hi,

    Does anybody have an idea about how to write a general report generator module?

    Right now, I can create a report file by coding the specific position on a page. codes like following:
    print_textbox(F ile, Page, 100, 100, 200, 300, "Hello");
    It means It prints the string "Hello" at the location starts from (100, 100) to(200,300 ).
    So, If I want to print the text at another location, I have to change the numberic data one by one. That is repeated work.
    Does it have any solution for it to reduce the times of modifying numberic data?

    Thanks
  • Banfa
    Recognized Expert Expert
    • Feb 2006
    • 9067

    #2
    Not without more information. I think you description of what you already have is too limited, you presumably don't just print "hello" each time. Post a larger section of pseudo code.

    In general if you have to change a output you are always going to have to provide a different input (unless you code is envoking undefine behaviour in which case just changing you hat might well do the trick).

    If, as I suspect you are printing a report with multiple times and you want to be able to shift all the items down 1 line (say) but only have to make 1 change then you should create a function that prints all items relative to a supplied orign, then to alter the position of everything all you need to do is alter the origin supplied to the function.

    Instead of

    Code:
    print_textbox(File, Page, 100, 100, 200, 300, "Hello");
    print_textbox(File, Page, 100, 100, 300, 400, "World");
    print_textbox(File, Page, 100, 100, 400, 500, "Wibble Banana Jellyfish");
    try

    Code:
    print_report( origin_x, origin_y )
        print_textbox(File, Page, origin_x+0, origin_x+0, origin_y+0, origin_y+100, "Hello");
        print_textbox(File, Page, origin_x+0, origin_x+0, origin_y+0, origin_y+100, "World");
        print_textbox(File, Page, origin_x+0, origin_x+0, origin_y+0, origin_y+100, "Wibble Banana Jellyfish");
    }
    
    print_report( 100, 200 )

    Comment

    • linbl352
      New Member
      • Apr 2006
      • 9

      #3
      yes. this is a solution of that problem.
      But, if I change the orientation style from portrait to landscape when I print the report, I have to change the parameters in function print_report(10 0,200). If there are many print_report(10 0,200) calls, It will cost much time on doing that multiple job.
      So, What I am looking for is automatically adjusting the postion according to the paper's size( width and height )

      Comment

      Working...