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. Exporting data to Excel worksheet

Exporting data to Excel worksheet

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++database
6 Posts 4 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.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    Hello guys, Consider I have some text data(maybe a Microsoft Access database *.mdb file too), and I want to save them as Microsoft Excel file. How can I achieve that ? thanks. PS. I have MFC Dialog based Application


    "Success is the ability to go from one failure to another with no loss of enthusiasm." - W.Churchill
    -- modified at 9:25 Saturday 4th February, 2006

    S G M 3 Replies Last reply
    0
    • L Lost User

      Hello guys, Consider I have some text data(maybe a Microsoft Access database *.mdb file too), and I want to save them as Microsoft Excel file. How can I achieve that ? thanks. PS. I have MFC Dialog based Application


      "Success is the ability to go from one failure to another with no loss of enthusiasm." - W.Churchill
      -- modified at 9:25 Saturday 4th February, 2006

      S Offline
      S Offline
      Stephen Hewitt
      wrote on last edited by
      #2

      I haven't actually tried this, but you might be able use Microsoft's ODBC driver for Excel[^]. Steve

      1 Reply Last reply
      0
      • L Lost User

        Hello guys, Consider I have some text data(maybe a Microsoft Access database *.mdb file too), and I want to save them as Microsoft Excel file. How can I achieve that ? thanks. PS. I have MFC Dialog based Application


        "Success is the ability to go from one failure to another with no loss of enthusiasm." - W.Churchill
        -- modified at 9:25 Saturday 4th February, 2006

        G Offline
        G Offline
        Graham Shanks
        wrote on last edited by
        #3

        You might want to save the data in Comma Separated Variable (csv) format. Excel can open csv format files directly. For instance:

        int value1 = 20;
        int value2 = 32;
        float value3 = 10.3f;
        FILE* myFile;
        myFile = fopen("c:\\temp\\foo.csv", "wt");
        if(myFile)
        {
        fprintf(myFile, "%d, %d, %.1f\n", value1, value2, value3);
        }
        fclose(myFile);

        Graham

        L 1 Reply Last reply
        0
        • G Graham Shanks

          You might want to save the data in Comma Separated Variable (csv) format. Excel can open csv format files directly. For instance:

          int value1 = 20;
          int value2 = 32;
          float value3 = 10.3f;
          FILE* myFile;
          myFile = fopen("c:\\temp\\foo.csv", "wt");
          if(myFile)
          {
          fprintf(myFile, "%d, %d, %.1f\n", value1, value2, value3);
          }
          fclose(myFile);

          Graham

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          thanks Graham.


          "Success is the ability to go from one failure to another with no loss of enthusiasm." - W.Churchill

          1 Reply Last reply
          0
          • L Lost User

            Hello guys, Consider I have some text data(maybe a Microsoft Access database *.mdb file too), and I want to save them as Microsoft Excel file. How can I achieve that ? thanks. PS. I have MFC Dialog based Application


            "Success is the ability to go from one failure to another with no loss of enthusiasm." - W.Churchill
            -- modified at 9:25 Saturday 4th February, 2006

            M Offline
            M Offline
            meinhard_risch
            wrote on last edited by
            #5

            I use this one since a long time. You're able to modify it like you want. http://www.codeproject.com/printing/testexcel.asp

            L 1 Reply Last reply
            0
            • M meinhard_risch

              I use this one since a long time. You're able to modify it like you want. http://www.codeproject.com/printing/testexcel.asp

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              meinhard_risch wrote:

              http://www.codeproject.com/printing/testexcel.asp

              Good link, thanks :)


              "Success is the ability to go from one failure to another with no loss of enthusiasm." - W.Churchill

              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