Sign in to follow this  
Followers 0
ajit

Open MSword in GUI

7 posts in this topic

HI:

I want to have Msword open a document in MY GUI.

I searched the forum without any sucess. Could someone help me do it or guide me to a link, or share a script they have.

Thanking in anticipation.

Regards

Ajit

Share this post


Link to post
Share on other sites



Why not open the Word document, grab the contents as RTF and paste it into a RichEdit control? Should be very close.


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

@jchd

Thanks very much for your quick reply.

I would want to use modify, save, and SaveAs in my GUI and also get word tools in my GUI. I am unsure whether Richedit would allow that. I am not very sure I have understood you properly either.

I was thinking of something like ObjCreate.

Thanks again.

Ajit

Edited by ajit

Share this post


Link to post
Share on other sites

I would want to use modify, save, and SaveAs in my GUI

That I believe isn't very difficult with the available GUI machinery.

and also get word tools in my GUI. I am unsure whether Richedit would allow that.

I hardly see an instance of Word cope with any homebrew GUI, yours or mine. It needs to handle its own controls, which you can't implement yourself.

I seem to recall that MS Office is also special in the way some (all?) controls are made. But this is possibly outdated knowledge. Just tried Au3Info: not that much success in finding standard stuff in a Word window.

I was thinking of something like ObjCreate.

That creates a Word instance (visible or not) with all bells and whistles but not in your garden. You might be able to fake it: cut down a child transparent window in your GUI and arrange to place it modal over the Word frame + toolbars & menus ... But I can't imagine Word acting with/on your own controls.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("Test Webbrowser", 400,300,400,300, _
         BitOr($GUI_SS_DEFAULT_GUI, $WS_SYSMENU ,$WS_SIZEBOX, $WS_MAXIMIZEBOX), $WS_EX_COMPOSITED)

$Obj = ObjCreate("Shell.Explorer.2")
$browser = GUICtrlCreateObj($Obj, 0, 0, 400, 300)
GUICtrlSetResizing ( -1, $GUI_DOCKRIGHT )

$wordfile = FileOpenDialog("Select MSword File", @DesktopDir & "\", "Docs (*.doc;*.dot)", 1 )
$Obj.Navigate($wordfile)
GUISetState(@SW_SHOW)


While 1
    $msg = GuiGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
    EndSelect
WEnd

Exit

@jchd

Thanks for your help.

I have a code using objectcreate but it does not seem to be working fine. I do not know whether it is the correct way of getting a word document in a GUI.

Furthermore it is not at all stable flickering all the time although the document can be modified.

Thanks in advance.

Ajit

Share this post


Link to post
Share on other sites

The problem lies inside your case statement. Your loop is just waiting for you to close the GUI. You should study the example given under Examples - GUI - Advanced called "menu.au3" see section posted below:

While 1
        $msg = GUIGetMsg()


        Select
            Case $msg = $GUI_EVENT_CLOSE Or $msg = $cancelbutton
                ExitLoop
                        ;You need a statement like this
            Case $msg = $fileitem
                $file = FileOpenDialog("Choose file...", @TempDir, "All (*.*)")
                If @error <> 1 Then GUICtrlCreateMenuItem($file, $recentfilesmenu)

                                ;This is where the actual loading should be done 
                    
            Case $msg = $exititem
                ExitLoop

            Case $msg = $okbutton
                MsgBox(0, "Click", "You clicked OK!")

            Case $msg = $aboutitem
                MsgBox(0, "About", "GUI Menu Test")
        EndSelect
    WEnd

You should look in help and try using;

#include <Word.au3>

_WordDocOpen ( ByRef $o_object , $s_FilePath [, $b_ConfirmConversions = 0 [, $i_Format = 0 [, $b_ReadOnly = 0 [, $b_Revert = 0 [, $b_AddToRecentFiles = 0 [, $s_PasswordDocument = "" [, $s_WritePasswordDocument = ""]]]]]]] )

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

@XKahn

Thanks for your help. I will work on those lines.

Thanks again.

Ajit

Edited by ajit

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0