Hi Guys,
Is there any way to read a .doc file and replace string in that file using Qt in Linux?
Here is my code, I have tried:
{
QFile file("/home/.../Desktop/file.doc");
file.open(QFile::ReadOnly);
QTextStream in(&file);
QString data = in.readAll();
file.close();
QTextDocument *doc=new QTextDocument(data);
int j=data.indexOf("Current",0);
data.remove(j,7);
data.insert(j,"Present");
QTextDocumentWriter *writer=new QTextDocumentWriter("/home/.../Desktop/newfile.doc");
writer->setFormat(".doc");
writer->write(doc);
}
Please help me to solve this problem.
Thanks.
Bookmarks