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