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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Generate report using C++ (MFC)

Generate report using C++ (MFC)

Scheduled Pinned Locked Moved C / C++ / MFC
c++databasehelptutorial
5 Posts 3 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.
  • X Offline
    X Offline
    xiAoYJia
    wrote on last edited by
    #1

    Any tips on how to generate report using C++ programming (MFC). I have worked with visual basic before and is aware that VB has their own built in reporting tool for report generation. But im not sure how to do that using C++ language. Do I need to use Crystal Report? The report will contain info that is retrieved from the database. This report should also support the print feature. Pls help me! Tks... Best Regards, xiAoYJia

    A J 2 Replies Last reply
    0
    • X xiAoYJia

      Any tips on how to generate report using C++ programming (MFC). I have worked with visual basic before and is aware that VB has their own built in reporting tool for report generation. But im not sure how to do that using C++ language. Do I need to use Crystal Report? The report will contain info that is retrieved from the database. This report should also support the print feature. Pls help me! Tks... Best Regards, xiAoYJia

      A Offline
      A Offline
      Antony M Kancidrowski
      wrote on last edited by
      #2

      BusinessObjects provide an API for Crystal Reports. You should be able to find example C++ code on their website. Ant. I'm hard, yet soft.
      I'm coloured, yet clear.
      I'm fruity and sweet.
      I'm jelly, what am I? Muse on it further, I shall return!
      - David Williams (Little Britain)

      1 Reply Last reply
      0
      • X xiAoYJia

        Any tips on how to generate report using C++ programming (MFC). I have worked with visual basic before and is aware that VB has their own built in reporting tool for report generation. But im not sure how to do that using C++ language. Do I need to use Crystal Report? The report will contain info that is retrieved from the database. This report should also support the print feature. Pls help me! Tks... Best Regards, xiAoYJia

        J Offline
        J Offline
        Jose Cezar S Ynion
        wrote on last edited by
        #3

        Best approach is using crystal report. You can use the Crystal report control just like in VB by adding the its OCX to your project. Crystal report object itself is capable of printing. You can pass query to your report in vc++.

        X 1 Reply Last reply
        0
        • J Jose Cezar S Ynion

          Best approach is using crystal report. You can use the Crystal report control just like in VB by adding the its OCX to your project. Crystal report object itself is capable of printing. You can pass query to your report in vc++.

          X Offline
          X Offline
          xiAoYJia
          wrote on last edited by
          #4

          Tks for your reply! I didnt work with Crystal Report in Visual Basic. I used their built in reporting tool instead. I would appreciate if u could provide me more details on "You can use the Crystal report control just like in VB by adding the its OCX to your project". Or do u happen to know of any good links that provide useful info? Best Regards, xiAoYJia

          J 1 Reply Last reply
          0
          • X xiAoYJia

            Tks for your reply! I didnt work with Crystal Report in Visual Basic. I used their built in reporting tool instead. I would appreciate if u could provide me more details on "You can use the Crystal report control just like in VB by adding the its OCX to your project". Or do u happen to know of any good links that provide useful info? Best Regards, xiAoYJia

            J Offline
            J Offline
            Jose Cezar S Ynion
            wrote on last edited by
            #5

            OK. I could send you a sample application. Just send me you email or your MSN ID so that we could chat. Using crystal report in vc++ is just like using any other registered control or active control if we would speak in vb. All you need is to add project reference to it, then drag the control to your dialog, assign a variable name to that control, then you can access the methods to display the report as simple as m_crystalreport.setaction() after initializing it. To make it simple, here are the steps that i followed: 1. Install Crystal report 2. Create a dialog based application. 3. Click PROJECT->ADD TO PROJECT->COMPONENTS AND CONTORLS menu. 4. Locate under registered activex control the crystal report. 5. Click OK. Some info will prompt. Just click OK 6. Back to you resource viewer. A new icon will be listed in your Control Toolbar. If you hover your mouse pointer to it, it will have a tooltip indicating a crystal report... 7. Add that to your dialog. 8. Assign a variable name to it, using class wizard. Say you name it m_crystalCtrl; 9. Back to your class browser, crystal report interface classes will be added to your project. Dont bother about that. 10. add a button to your dialog, then add event hadler to it. say button _click event. 11. Assuming that you already created a report template( connected it with your db), then you can display the report by adding the following code: m_crystalCtrl.SetReportFileName("MyReportFilename.rpt"); // change to you report filename m_crystalCtrl.SetWindowMaxButton(TRUE); m_crystalCtrl.SetWindowMinButton(TRUE); m_crystalCtrl.SetProgressDialog(FALSE); m_crystalCtrl.SetWindowShowProgressCtls(FALSE); m_crystalCtrl.SetWindowState(2); //Maximized m_crystalCtrl.SetDestination(0); //To Window = 0 Printer = 1. m_crystalCtrl.SetAction(1); m_crystalCtrl.Reset();

            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