PDA

View Full Version : ActiveQt Word



Ieshir
12th November 2013, 19:54
Hello, how can I do this (http://office.microsoft.com/en-us/word-help/add-bullets-or-numbers-to-a-list-HA010065012.aspx) using ActiveQt?

ChrisW67
15th November 2013, 04:24
You will have to ask Microsoft how you would use their automation interface to achieve whichever bit of that page it is you want to do. Before you know how it is done without Qt you will not be able to do it with Qt.

patrik08
15th November 2013, 07:54
if you like to use word docx on qt .. yesterday a write a xslt converter....
xmlpatterns from qt its nice to use as xslt2 or xsltproc xslt1 and can run on mac linux or window

ActiveQt Word run only on window...

docx is all xml based and can use as template... to write new file... docx


https://github.com/pehohlva/qt-gmail-access/blob/master/console_doc/docx2html.xsl

same to odt openformat:

https://github.com/pehohlva/qt-gmail-access/blob/master/console_doc/odt2html.xsl




QStringList args;
args << "xsltproc";
bin_xsltproc = execlocal(QString("which"), args).simplified();

QString Document::execlocal(const QString cmd, const QStringList args) {

/// cmd is xmlpatterns or xsltproc
QString debughere = cmd;
int success = -1;
debughere.append(" ");
debughere.append(args.join(" "));
console(QString("EXEC: %1").arg(debughere));
QString rec;
QProcess *process = new QProcess(NULL);
process->setReadChannelMode(QProcess::MergedChannels);
process->start(cmd, args, QIODevice::ReadOnly);
//// waitForFinished default int msecs = 30000 ok
if (!process->waitForFinished()) {
success = -1;
} else {
success = 1;
rec = process->readAll();
}
if (success == 1) {
return rec;
} else {
return QString("ERROR: Time out by %1").arg(debughere);
}
}



if (doc_continue && !bin_xsltproc.isEmpty()) {
/// convert xslt now by
console(QString("Init xslt convert...%1.").arg(bin_xsltproc));
QStringList xsltparam;
xsltparam << "--param";
xsltparam << "convert_time";
xsltparam << QString("'%1'").arg(Tools::TimeNow());
xsltparam << "--output";
xsltparam << indexhtmlnewfile;
xsltparam << worddocx2htmlstyle;
xsltparam << word_document.xml; /// by unzip docx
/// xslt param --param name "value"
const QString errorcmd = execlocal(bin_xsltproc, xsltparam);
if (errorcmd.isEmpty()) {
console(QString("Xslt convert successful document..."));
} else {
console(QString("Xslt convert... say: %1").arg(errorcmd));
}
}

Ieshir
16th November 2013, 14:11
how use this?

patrik08
16th November 2013, 17:55
Xslt is a xml language read at http://en.wikipedia.org/wiki/XSLT and qt help to transform document
take a word document name.docx and rename this doc to name.zip and you find inside a lot of xml and image file...
all this you can handle und transform to other format or simple html....

here a sample from converting docx to html

9797

the full sample is inside a zip:
Docx sample:
http://freeroad.ch/archivio/convertresult/docxconvert.zip
Pdf convert sample: without poppler only pdftohtml -xml option
http://freeroad.ch/archivio/convertresult/pdfconvert.zip

Ieshir
16th November 2013, 18:36
thank u
&&