Important: Please read the Qt Code of Conduct -

How to convert document from Word to HTML

  • Hi!
    How to convert document from Word to HTML?
    Thise my code.

        QString ResumeFileName ("");
        ResumeFileName = QFileDialog::getOpenFileName(0, "Text ", "", "*.doc *.docx *.rtf");
        ResumeFileName.replace(QRegExp("[/]"), "\\");
        if (ResumeFileName != "")
            QAxObject   wordApplication("Word.Application");
            QAxObject *documents = wordApplication.querySubObject("Documents");
            QAxObject *document = documents->querySubObject("Open(const QString&, bool)", ResumeFileName, true);
            QAxObject *words = document->querySubObject("Words");
            QString TextResume;
            QString HTMLResume;
            int countWord = words->dynamicCall("Count()").toInt();
            for (int a = 1; a <= countWord; a++){
                TextResume.append(words->querySubObject("Item(int)", a)->dynamicCall("Text()").toString());
                HTMLResume.append(words->querySubObject("Item(int)", a)->dynamicCall("Text()").SomethingFfunction);
            document->dynamicCall("Close (boolean)", false);
            TextResume.replace(QRegExp("[\r]"), "\r\n"); 
            QString Coments1 ("");
            LoadResumeInDB(TextResume, Coments1, HTMLResume);

Log in to reply