Hi, everyone.
How can I display the word-file(.docx) on article scene?
Just like HTML and PDF file, can read on article scene directly.
Now, DOC can only download, then open with MicrosoftWord.
THANKS
Hi, everyone.
How can I display the word-file(.docx) on article scene?
Just like HTML and PDF file, can read on article scene directly.
Now, DOC can only download, then open with MicrosoftWord.
THANKS
Have you tried using the “Google embedded viewer Plugin” (under Generic Plugins)?
Hi @ctgraham, Good day~~
I’v enabled the “Google embedded viewer Plugin” just a moment ago, but DOC still just downloaded directly!
In addition to, whether some template must also be modified?
Thanks & Regards
Hmmm… yes, it looks like the Google Viewer plugin only hooks the pdfViewer.tpl. The Google Viewer itself should be able to handle a wider array of files, include Word Documents.
Are you comfortable with PHP and Smarty? If so, you could change the code.
The type of viewing action is selected here:
The logical choice seems to be to identify this as “inline-able”, but the list of “inline” eligible filetypes is a bit buried, so that may not be the best override:
The galley submission file’s isInlineable() check calls PKPFileDAO::isInlineable()
, which reads a Registry source, and there are no hooks in between.
Easier would be to attach the googleViewer plugin to the ArticleHandler::downloadFile
hook. You would need to use the passed in $article
and $galley
variables to determine if this filetype was one that should be displayed instead of downloaded, and then instanciate the PKPTemplateManager
and output the googleViewer’s index.tpl
.
It would be a fairly complex change, but would also be a pretty good pull request for incorporation into the base product, if you are interested in taking it on.