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. File streaming problem

File streaming problem

Scheduled Pinned Locked Moved C / C++ / MFC
c++questionhelp
15 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.
  • G Offline
    G Offline
    gajendrakashyap
    wrote on last edited by
    #1

    I'm new to MFC and started developing applications just a few months back. I'm trying to build an application using which I can read a word document and get the information that I need. Can anyone tell me how can I perform simple file operation on a word document similar to text files like Getline()? Something similar to C or C++ file operations. :) Thanks, Gajendra

    E C D 3 Replies Last reply
    0
    • G gajendrakashyap

      I'm new to MFC and started developing applications just a few months back. I'm trying to build an application using which I can read a word document and get the information that I need. Can anyone tell me how can I perform simple file operation on a word document similar to text files like Getline()? Something similar to C or C++ file operations. :) Thanks, Gajendra

      E Offline
      E Offline
      earl
      wrote on last edited by
      #2

      I don't know that the doc format is well documented. I'd suggest using Word through COM to read / write the files, though this will require that Word be installed on the same machine as your program. earl

      C 1 Reply Last reply
      0
      • G gajendrakashyap

        I'm new to MFC and started developing applications just a few months back. I'm trying to build an application using which I can read a word document and get the information that I need. Can anyone tell me how can I perform simple file operation on a word document similar to text files like Getline()? Something similar to C or C++ file operations. :) Thanks, Gajendra

        C Offline
        C Offline
        Cedric Moonen
        wrote on last edited by
        #3

        It is not that easy. A word document has a very specific format and you won't be able to read it like that. You need to go for Word automation (search this site or google or MSDN to learn how it works).


        Cédric Moonen Software developer
        Charting control

        G 1 Reply Last reply
        0
        • E earl

          I don't know that the doc format is well documented. I'd suggest using Word through COM to read / write the files, though this will require that Word be installed on the same machine as your program. earl

          C Offline
          C Offline
          Cedric Moonen
          wrote on last edited by
          #4

          earl wrote:

          though this will require that Word be installed on the same machine as your program

          AFAIK, you don't need to install word on the target computer. Just a simple dll (don't remember its name) will be ok.


          Cédric Moonen Software developer
          Charting control

          1 Reply Last reply
          0
          • G gajendrakashyap

            I'm new to MFC and started developing applications just a few months back. I'm trying to build an application using which I can read a word document and get the information that I need. Can anyone tell me how can I perform simple file operation on a word document similar to text files like Getline()? Something similar to C or C++ file operations. :) Thanks, Gajendra

            D Offline
            D Offline
            David Crow
            wrote on last edited by
            #5

            I would opt for Word's COM interface, but if you really want to navigate the file yourself, the format of some of the older versions of Word can be found here.


            "Money talks. When my money starts to talk, I get a bill to shut it up." - Frank

            "Judge not by the eye but by the heart." - Native American Proverb

            G 2 Replies Last reply
            0
            • C Cedric Moonen

              It is not that easy. A word document has a very specific format and you won't be able to read it like that. You need to go for Word automation (search this site or google or MSDN to learn how it works).


              Cédric Moonen Software developer
              Charting control

              G Offline
              G Offline
              gajendrakashyap
              wrote on last edited by
              #6

              Cedric Moonen wrote:

              It is not that easy. A word document has a very specific format and you won't be able to read it like that. You need to go for Word automation (search this site or google or MSDN to learn how it works). Cédric Moonen Software developer

              I checked the MSDN library online and I could find some Stream operations but they are not very clear to me.:confused: CFile cFile(TEXT("File.rtf"), CFile::modeRead); Can I use this class functions to perform operations successfully? Well it seems so...

              C 1 Reply Last reply
              0
              • D David Crow

                I would opt for Word's COM interface, but if you really want to navigate the file yourself, the format of some of the older versions of Word can be found here.


                "Money talks. When my money starts to talk, I get a bill to shut it up." - Frank

                "Judge not by the eye but by the heart." - Native American Proverb

                G Offline
                G Offline
                gajendrakashyap
                wrote on last edited by
                #7

                Hi David, I'm not aware of COM :(( Please suggest something else... If this is the best then I'll have to get on with it.:~

                D 1 Reply Last reply
                0
                • G gajendrakashyap

                  Cedric Moonen wrote:

                  It is not that easy. A word document has a very specific format and you won't be able to read it like that. You need to go for Word automation (search this site or google or MSDN to learn how it works). Cédric Moonen Software developer

                  I checked the MSDN library online and I could find some Stream operations but they are not very clear to me.:confused: CFile cFile(TEXT("File.rtf"), CFile::modeRead); Can I use this class functions to perform operations successfully? Well it seems so...

                  C Offline
                  C Offline
                  Cedric Moonen
                  wrote on last edited by
                  #8

                  I said that you have to look for 'Word automation'. Did you read my post :confused: ? I never spoke about Stream operation. What I suggested you is exactly the same as the other suggested: using a COM interface for Word (it's just another word for the same thing). You won't be able to read the file if you don't know how it is structured. And I don't think you know (neither do I)


                  Cédric Moonen Software developer
                  Charting control

                  G 1 Reply Last reply
                  0
                  • C Cedric Moonen

                    I said that you have to look for 'Word automation'. Did you read my post :confused: ? I never spoke about Stream operation. What I suggested you is exactly the same as the other suggested: using a COM interface for Word (it's just another word for the same thing). You won't be able to read the file if you don't know how it is structured. And I don't think you know (neither do I)


                    Cédric Moonen Software developer
                    Charting control

                    G Offline
                    G Offline
                    gajendrakashyap
                    wrote on last edited by
                    #9

                    Thanks Cedric !! I'll gather more information and then probably I'll ask specific questions. Gajendra

                    1 Reply Last reply
                    0
                    • G gajendrakashyap

                      Hi David, I'm not aware of COM :(( Please suggest something else... If this is the best then I'll have to get on with it.:~

                      D Offline
                      D Offline
                      David Crow
                      wrote on last edited by
                      #10

                      gajendrakashyap wrote:

                      I'm not aware of COM

                      a.k.a. Outlook Automatioon.


                      "Money talks. When my money starts to talk, I get a bill to shut it up." - Frank

                      "Judge not by the eye but by the heart." - Native American Proverb

                      1 Reply Last reply
                      0
                      • D David Crow

                        I would opt for Word's COM interface, but if you really want to navigate the file yourself, the format of some of the older versions of Word can be found here.


                        "Money talks. When my money starts to talk, I get a bill to shut it up." - Frank

                        "Judge not by the eye but by the heart." - Native American Proverb

                        G Offline
                        G Offline
                        gajendrakashyap
                        wrote on last edited by
                        #11

                        Hi David, It would be a great help if you could give me a clear idea how to go about this. Probably names of those interfaces and some help on using them. Tips ... Thanks, Gajendra

                        D 1 Reply Last reply
                        0
                        • G gajendrakashyap

                          Hi David, It would be a great help if you could give me a clear idea how to go about this. Probably names of those interfaces and some help on using them. Tips ... Thanks, Gajendra

                          D Offline
                          D Offline
                          David Crow
                          wrote on last edited by
                          #12

                          See here, and then click the "Visual C++/MFC - Information and Sample Code" link. There's also MSDN articles like Q220911, Q261997, Q222101, Q196776, Q192348.


                          "Money talks. When my money starts to talk, I get a bill to shut it up." - Frank

                          "Judge not by the eye but by the heart." - Native American Proverb

                          G 1 Reply Last reply
                          0
                          • D David Crow

                            See here, and then click the "Visual C++/MFC - Information and Sample Code" link. There's also MSDN articles like Q220911, Q261997, Q222101, Q196776, Q192348.


                            "Money talks. When my money starts to talk, I get a bill to shut it up." - Frank

                            "Judge not by the eye but by the heart." - Native American Proverb

                            G Offline
                            G Offline
                            gajendrakashyap
                            wrote on last edited by
                            #13

                            Hi David, All this is going to help me a lot. I will try to work out on these sample codes. I could not find the last article Q192348. Thanks much for the help. Regards, Gajendra

                            D 1 Reply Last reply
                            0
                            • G gajendrakashyap

                              Hi David, All this is going to help me a lot. I will try to work out on these sample codes. I could not find the last article Q192348. Thanks much for the help. Regards, Gajendra

                              D Offline
                              D Offline
                              David Crow
                              wrote on last edited by
                              #14

                              gajendrakashyap wrote:

                              I could not find the last article Q192348.

                              Q192348[^] You'll note that some of those articles are for Excel. That's not because I think Word is synonymous with Excel, I just wanted to give you other Automation examples.


                              "Money talks. When my money starts to talk, I get a bill to shut it up." - Frank

                              "Judge not by the eye but by the heart." - Native American Proverb

                              G 1 Reply Last reply
                              0
                              • D David Crow

                                gajendrakashyap wrote:

                                I could not find the last article Q192348.

                                Q192348[^] You'll note that some of those articles are for Excel. That's not because I think Word is synonymous with Excel, I just wanted to give you other Automation examples.


                                "Money talks. When my money starts to talk, I get a bill to shut it up." - Frank

                                "Judge not by the eye but by the heart." - Native American Proverb

                                G Offline
                                G Offline
                                gajendrakashyap
                                wrote on last edited by
                                #15

                                Yes I could find articles on word, powerpoint, excel, outlook etc. Not a problem as I can use excel also for my project. We've made a program in VB that reads excel and gives the output we need. We're working to refine it. I think MFC would also be great at work. Thanks, Gajendra

                                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