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 to read the contents of a doc file and write the contents into another doc file?

How to read the contents of a doc file and write the contents into another doc file?

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorialquestion
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.
  • A Offline
    A Offline
    asenthil_8585
    wrote on last edited by
    #1

    hai to all... Can any body plzz help me for this process? i want to read the contents of a doc file(ms word file) and write the contents into another doc file(ms word file)... How shall i do this? i tried the following method, but itz working only reading and writing text files.. #include #include #include #include using namespace std; void main () { string line; ifstream myfile ("C:/1.doc"); if (myfile.is_open()) { while (! myfile.eof() ) { getline (myfile,line); cout << line << endl; } myfile.close(); } else cout << "Unable to open file"; ofstream myfile1; myfile1.open ("C:/2.doc"); myfile1 << line; myfile1.close(); getch(); } Can anybocy plzz help me how to read and write for doc files...

    senthil.

    J L 2 Replies Last reply
    0
    • A asenthil_8585

      hai to all... Can any body plzz help me for this process? i want to read the contents of a doc file(ms word file) and write the contents into another doc file(ms word file)... How shall i do this? i tried the following method, but itz working only reading and writing text files.. #include #include #include #include using namespace std; void main () { string line; ifstream myfile ("C:/1.doc"); if (myfile.is_open()) { while (! myfile.eof() ) { getline (myfile,line); cout << line << endl; } myfile.close(); } else cout << "Unable to open file"; ofstream myfile1; myfile1.open ("C:/2.doc"); myfile1 << line; myfile1.close(); getch(); } Can anybocy plzz help me how to read and write for doc files...

      senthil.

      J Offline
      J Offline
      jhwurmbach
      wrote on last edited by
      #2

      Maybe writing a MACRO for MSWord (or OpenOffice!) is easier than deciphering the proprietary DOC-Format?


      "We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation." -- Caius Petronius, Roman Consul, 66 A.D.

      1 Reply Last reply
      0
      • A asenthil_8585

        hai to all... Can any body plzz help me for this process? i want to read the contents of a doc file(ms word file) and write the contents into another doc file(ms word file)... How shall i do this? i tried the following method, but itz working only reading and writing text files.. #include #include #include #include using namespace std; void main () { string line; ifstream myfile ("C:/1.doc"); if (myfile.is_open()) { while (! myfile.eof() ) { getline (myfile,line); cout << line << endl; } myfile.close(); } else cout << "Unable to open file"; ofstream myfile1; myfile1.open ("C:/2.doc"); myfile1 << line; myfile1.close(); getch(); } Can anybocy plzz help me how to read and write for doc files...

        senthil.

        L Offline
        L Offline
        Laxman Auti
        wrote on last edited by
        #3

        senthil wrote:

        Can anybocy plzz help me how to read and write for doc files...

        You can't read the content of the ms document as it is binary file. You can read from one doc and write to another doc by using binary files(i.e. open files in binary mode). Knock out 't' from can't, You can if you think you can :cool:

        A 1 Reply Last reply
        0
        • L Laxman Auti

          senthil wrote:

          Can anybocy plzz help me how to read and write for doc files...

          You can't read the content of the ms document as it is binary file. You can read from one doc and write to another doc by using binary files(i.e. open files in binary mode). Knock out 't' from can't, You can if you think you can :cool:

          A Offline
          A Offline
          asenthil_8585
          wrote on last edited by
          #4

          Hai laxman, thanks for ur reply... now itz working perfectly in binary mode.... thanks for ur valuble suggestion... now i'm trying to convert a html file into a pdf file or an image file using VC++... R u having any idea about this... thanks...

          senthil.

          L 1 Reply Last reply
          0
          • A asenthil_8585

            Hai laxman, thanks for ur reply... now itz working perfectly in binary mode.... thanks for ur valuble suggestion... now i'm trying to convert a html file into a pdf file or an image file using VC++... R u having any idea about this... thanks...

            senthil.

            L Offline
            L Offline
            Laxman Auti
            wrote on last edited by
            #5

            senthil wrote:

            now i'm trying to convert a html file into a pdf file or an image file using VC++... R u having any idea about this...

            No, I don't have any idea, but you may refer following article. it may help you. http://www.codeproject.com/csharp/sertf2pdf.asp[^] Knock out 't' from can't, You can if you think you can :cool:

            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