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. Create Reports similar to Access

Create Reports similar to Access

Scheduled Pinned Locked Moved C / C++ / MFC
databasetutorialquestion
6 Posts 5 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.
  • T Offline
    T Offline
    Toni78
    wrote on last edited by
    #1

    I really have no experience when it comes to creating documents for printing. Actually, I do not know anything when it comes to writing code for printing. For example, in a database application which I wrote about a year and half ago I would like to add the capability of creating reports similar to those in Access. I do not know from where to begin. Do I just create a window and then I add text and lines to it and then send that window to a printer? This is the only idea that pops into my head but it sounds so inefficient. Is there a place online where I can read some tutorials? It doesn't really have to be about creating reports but something similar about creating documents and printing them. // Afterall, I realized that even my comment lines have bugs If the sun were to blow up, it would take us 7-8 minutes to realize it.

    A R I R T 5 Replies Last reply
    0
    • T Toni78

      I really have no experience when it comes to creating documents for printing. Actually, I do not know anything when it comes to writing code for printing. For example, in a database application which I wrote about a year and half ago I would like to add the capability of creating reports similar to those in Access. I do not know from where to begin. Do I just create a window and then I add text and lines to it and then send that window to a printer? This is the only idea that pops into my head but it sounds so inefficient. Is there a place online where I can read some tutorials? It doesn't really have to be about creating reports but something similar about creating documents and printing them. // Afterall, I realized that even my comment lines have bugs If the sun were to blow up, it would take us 7-8 minutes to realize it.

      A Offline
      A Offline
      Andrew Walker
      wrote on last edited by
      #2

      You've got lots of choices, but it depends on what dependancies you can afford to introduce into your software. If you already have the reports in access how about using access via the COM automation interfaces. Alternatively word automation is probably easier to get started with, especially if you want to construct temporary html files and then load them in word, or use ShellExecute api to print. If clients can't be guaranteed to have office you could also use IWebBrowser2 and related interfaces (perhaps IHTMLWindow3) to provide a low dependancy (only the standard internet explorer control) printing method - I haven't used this approach but I don't see it being too hard. Another report generation idea is to convert the results of queries to xml and then use xslt as a flexible and extensible formatting system. Alternatively MFC has extensive documentation on printing.


      If you can keep you head when all about you Are losing theirs and blaming it on you; If you can dream - and not make dreams your master; If you can think - and not make thoughts your aim; Yours is the Earth and everything that's in it. Rudyard Kipling

      1 Reply Last reply
      0
      • T Toni78

        I really have no experience when it comes to creating documents for printing. Actually, I do not know anything when it comes to writing code for printing. For example, in a database application which I wrote about a year and half ago I would like to add the capability of creating reports similar to those in Access. I do not know from where to begin. Do I just create a window and then I add text and lines to it and then send that window to a printer? This is the only idea that pops into my head but it sounds so inefficient. Is there a place online where I can read some tutorials? It doesn't really have to be about creating reports but something similar about creating documents and printing them. // Afterall, I realized that even my comment lines have bugs If the sun were to blow up, it would take us 7-8 minutes to realize it.

        R Offline
        R Offline
        Ryan Binns
        wrote on last edited by
        #3

        Printing is very similar to drawing on the screen - you use a device context and draw to it. The only thing you really have to watch out for is separating the documents into pages (CDC::BeginPage() and CDC::EndPage() in MFC) and remember that the printing resolution is a lot higher than the screen, so use CDC::GetDeviceCaps() to get the DPI of the printer. Use CPrintDialog to show the print dialog to the user, and the dialog also returns a device context for the printer which is already setup, so all you'll need to do is draw to the DC. Have a look at the documentation for more info, but it really is actually quite easy.

        Ryan

        "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

        1 Reply Last reply
        0
        • T Toni78

          I really have no experience when it comes to creating documents for printing. Actually, I do not know anything when it comes to writing code for printing. For example, in a database application which I wrote about a year and half ago I would like to add the capability of creating reports similar to those in Access. I do not know from where to begin. Do I just create a window and then I add text and lines to it and then send that window to a printer? This is the only idea that pops into my head but it sounds so inefficient. Is there a place online where I can read some tutorials? It doesn't really have to be about creating reports but something similar about creating documents and printing them. // Afterall, I realized that even my comment lines have bugs If the sun were to blow up, it would take us 7-8 minutes to realize it.

          I Offline
          I Offline
          Iain Clarke Warrior Programmer
          wrote on last edited by
          #4

          In addition to the previous advice, you would do well to search for articles on codeproject by its defacto printing guru Roger Allen[^]. He has quite a few printing articles, with and without views, etc. He's also a nice chap, but tell him I said that. He'll get big headed. Iain.

          1 Reply Last reply
          0
          • T Toni78

            I really have no experience when it comes to creating documents for printing. Actually, I do not know anything when it comes to writing code for printing. For example, in a database application which I wrote about a year and half ago I would like to add the capability of creating reports similar to those in Access. I do not know from where to begin. Do I just create a window and then I add text and lines to it and then send that window to a printer? This is the only idea that pops into my head but it sounds so inefficient. Is there a place online where I can read some tutorials? It doesn't really have to be about creating reports but something similar about creating documents and printing them. // Afterall, I realized that even my comment lines have bugs If the sun were to blow up, it would take us 7-8 minutes to realize it.

            R Offline
            R Offline
            RomanBe
            wrote on last edited by
            #5

            Hi Toni If you want to make more complex reports, i would suggest to check the functionality of some report systems like list&label or crystal reports. I especially know list&label and you can create your reports almost with drag and drop and fill them with data.

            1 Reply Last reply
            0
            • T Toni78

              I really have no experience when it comes to creating documents for printing. Actually, I do not know anything when it comes to writing code for printing. For example, in a database application which I wrote about a year and half ago I would like to add the capability of creating reports similar to those in Access. I do not know from where to begin. Do I just create a window and then I add text and lines to it and then send that window to a printer? This is the only idea that pops into my head but it sounds so inefficient. Is there a place online where I can read some tutorials? It doesn't really have to be about creating reports but something similar about creating documents and printing them. // Afterall, I realized that even my comment lines have bugs If the sun were to blow up, it would take us 7-8 minutes to realize it.

              T Offline
              T Offline
              Toni78
              wrote on last edited by
              #6

              Thank you very much for your replies everyone. // Afterall, I realized that even my comment lines have bugs

              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