Menu

#16 OpenWord-plugin

open
nobody
None
5
2005-08-24
2005-08-24
Koen
No

I'm building a CMS in which lots of Word-documents has
to be pasted.
Although the original method of copying and pasting
Word-documents works fine for me, some people asked
me to implement a more convenient method.

So I made a plugin which can be used with Internet
Explorer.
One can just browse on the computer or network and
click on the desired Word-document.
This plugin makes use of ActiveX (so it can be used in
Internet Explorer only).
The easiest way to enable ActiveX is to put the website
in the list of trusted websites en enabled the ActiveX-
settings.

In the enclosed zip-file is a readme-file.

The working of the plugin: after selecting a Word-
document, the content of it is put on the Clipboard. The
function GetClipboardHTML() grabs it from the Clipboard
and if desired cleans the Word-content (I used the
original function CleanWord( html ) from fck_paste.html).

I hope this plugin, although only for Internet Explorer,
can be usefull for anyone.
Any improvement or comment will be welcome

Discussion

  • Koen

    Koen - 2005-08-26

    OpenWord.zip

     
  • Frederik Frost Nielsen

    Logged In: YES
    user_id=915246

    This is a very awesome plugin - good job!!

    Very handy for us lazy ppl :D

     
  • George K

    George K - 2005-10-03

    Logged In: YES
    user_id=1355701

    I have Word 2000. I had to change this part of the code to the
    following in order to make winword.exe shut after the html
    import.

    if (word != null)
    {
    doc = word.Documents.Open(file); /* Return the
    opened doc
    word.Documents(file).Range(0).Copy();
    content = oEditor.FCK.GetClipboardHTML();
    var bCleanWord = document.
    getElementById('chkCleanWord').checked ;
    if (bCleanWord)
    {
    content=CleanWord(content);
    }
    oEditor.FCK.InsertHtml( content ) ;
    window.clipboardData.clearData('Text');
    doc.Close(0); /* close the document */
    word.Quit();
    window.close();
    }

    Don't know if anyone else with different word versions has the
    problem but that's the fix anyway.

    Cheers for the plugin.

     
  • Koen

    Koen - 2005-10-03

    Logged In: YES
    user_id=952521

    Weird.
    I'm using Word 2000 myself and have nog problems. Also i've
    been testing it with Word 2003.

    Wel anyway, if it works ...

     
  • George K

    George K - 2005-10-05

    Logged In: YES
    user_id=1355701

    Yeah, i didn't think you'd post something with that error,
    maybe it's just my installation of Word or something. Anyway,
    my patch shouldn't have any negative consequences for you.

    As you're probably doing the same sort of stuff as me, I was
    wondering, have you had any issues with FCK auto formatting
    the word doc for the print preview etc?

    I'm writing a web app where it is needed to allow the users to
    write a Word doc and save it as html (cos most users are
    incapable of writing a real html doc), then upload the html file
    and related files folder to the web server. The app then allows
    users to navigate to the available docs and open them for
    printing (it inserts some data from the app in the process). If
    they want to edit them for printing, i read the html contents
    into an FCK control and they can edit away.

    Obviously Word outputs loads of crap html, like the vml stuff
    and xmlns for images and page break markers, but this allows
    users to create docs easily and print them exactly as they are
    seen in Word. The automatic formatting by FCK seems to
    remove namespaces and the vml markup, so images are no
    longer visible. Also, they cannot see and remove or add page
    breaks. Have you done any work on this at all or found a
    plugin for FCK?

    I'd do it but my RegEx knowledge is poor/non existant.

     
  • purityys

    purityys - 2007-08-07

    Logged In: YES
    user_id=1861955
    Originator: NO

    good job!!

     

Log in to post a comment.

Monday.com Logo