Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How can I produce a report ...

How can I produce a report ...

Scheduled Pinned Locked Moved C / C++ / MFC
question
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Q Offline
    Q Offline
    Qadddd
    wrote on last edited by
    #1

    ... like I can produce with Excel ? I have a lot of lines a columns Of different length to format and then print the result on a printer. How can I do that ? Any idea appreciated ... DD

    J 1 Reply Last reply
    0
    • Q Qadddd

      ... like I can produce with Excel ? I have a lot of lines a columns Of different length to format and then print the result on a printer. How can I do that ? Any idea appreciated ... DD

      J Offline
      J Offline
      Jorgen Sigvardsson
      wrote on last edited by
      #2

      Crystal Reports is one solution. Reusing Excel via its automation interfaces is another. Generating HTML and pass it to the printer via Shell/IE can also be done. Another solution is to use GDI directly. The options are many (about as many as there are report libraries). -- You're entertaining at least.

      Q 1 Reply Last reply
      0
      • J Jorgen Sigvardsson

        Crystal Reports is one solution. Reusing Excel via its automation interfaces is another. Generating HTML and pass it to the printer via Shell/IE can also be done. Another solution is to use GDI directly. The options are many (about as many as there are report libraries). -- You're entertaining at least.

        Q Offline
        Q Offline
        Qadddd
        wrote on last edited by
        #3

        thanks for the answer ! 1) let's forget about Crystal Report, I have not enough money to buy it ... 2) Excel ... why not, but it supposes that all station using my application has Excel installed, and I am not sure I want to have a such dependence ... 3) HTML ... Is there an easy way to produce HTML code from VC++ or do I have to handle myself all HTML tags ? Can you be more precise on this "pass it to the printer via Shell/IE" or indicate me an article where I can read something on it 4) use GDI directly : this means drawing myself all lines and columns, insert all figures, change the fonts, etc ... I think I was more or less thinking to this kind of solution ... but isn't it to hard/tedious to do this ? I will see if I can find some articles on this Thanks again for your help DD

        J 1 Reply Last reply
        0
        • Q Qadddd

          thanks for the answer ! 1) let's forget about Crystal Report, I have not enough money to buy it ... 2) Excel ... why not, but it supposes that all station using my application has Excel installed, and I am not sure I want to have a such dependence ... 3) HTML ... Is there an easy way to produce HTML code from VC++ or do I have to handle myself all HTML tags ? Can you be more precise on this "pass it to the printer via Shell/IE" or indicate me an article where I can read something on it 4) use GDI directly : this means drawing myself all lines and columns, insert all figures, change the fonts, etc ... I think I was more or less thinking to this kind of solution ... but isn't it to hard/tedious to do this ? I will see if I can find some articles on this Thanks again for your help DD

          J Offline
          J Offline
          Jorgen Sigvardsson
          wrote on last edited by
          #4

          Qadddd wrote: Can you be more precise on this "pass it to the printer via Shell/IE" or indicate me an article where I can read something on it You can either load IE with the result HTML, or your could use the shell API function ShellExecute to print. A simple solution is to just load the report into IE - the user usually wants to preview reports and then print it. As for generating HTML, I think you'll have to be on the creative side there. I'd build primitives (C++ classes) for generating low level HTML. One class per element basically - and build an HTML object model from there. I'm not sure, but I think MSHTML does this already. Consult the MSDN documentation for further info on that API. Ontop of MSHTML, you can build your own abstractions like ReportHeader, ReportFooter, ReportBody, etc. Abstractions that uses and composes the MSHTML objects in concise way. This combined with CSS can yield pretty good looking reports, but it'll cost you the knowledge of HTML and CSS + various APIs. Qadddd wrote: use GDI directly ... but isn't it to hard/tedious to do this ? Uh huh. That's why there's a business for report generation tools. :) -- You're entertaining at least.

          Q 1 Reply Last reply
          0
          • J Jorgen Sigvardsson

            Qadddd wrote: Can you be more precise on this "pass it to the printer via Shell/IE" or indicate me an article where I can read something on it You can either load IE with the result HTML, or your could use the shell API function ShellExecute to print. A simple solution is to just load the report into IE - the user usually wants to preview reports and then print it. As for generating HTML, I think you'll have to be on the creative side there. I'd build primitives (C++ classes) for generating low level HTML. One class per element basically - and build an HTML object model from there. I'm not sure, but I think MSHTML does this already. Consult the MSDN documentation for further info on that API. Ontop of MSHTML, you can build your own abstractions like ReportHeader, ReportFooter, ReportBody, etc. Abstractions that uses and composes the MSHTML objects in concise way. This combined with CSS can yield pretty good looking reports, but it'll cost you the knowledge of HTML and CSS + various APIs. Qadddd wrote: use GDI directly ... but isn't it to hard/tedious to do this ? Uh huh. That's why there's a business for report generation tools. :) -- You're entertaining at least.

            Q Offline
            Q Offline
            Qadddd
            wrote on last edited by
            #5

            Hello, Finally I choose to play with GDI . So I use these pDC->MoveTo(Startx, z) and pDC->LineTo((Startx + LTot), z) to draw the grid and these pDC->GetTextExtent(C61Title[0]) and pDC->TextOut(a, b, C61Title[0]) to put my value in the grid. Now, in order to better differenciate the titles from the values, I would like to fill in grey the cells before writting my titles in ... do you have an idea of how I can do this ? Thanks in advance DD

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups