Sign in to follow this  
Followers 0
SlimShady

Excel sheet in GUI

6 posts in this topic

#1 ·  Posted (edited)

I want to mimic a grid by integrating an Excel sheet.

But I can't make it work.

If you have a working example, please share.

Here's my current script.

#include <GUIConstants.au3>

Opt('OnExitFunc', 'Error')

GUICreate("Test", 200, 200)

$oExcel = ObjCreate("Excel.Application")                  ; Create an Excel Object

GUISetState()

If IsObj ($oExcel) Then
   GUICtrlCreateObj($oExcel, 0, 0, 150, 150)
  ;$oExcel.Visible = 1                                     ; Let Excel show itself
   $oExcel.WorkBooks.Add                                     ; Add a new workbook
   $oExcel.ActiveWorkBook.ActiveSheet.Cells(1,1).Value="test"; Fill a cell
   $oExcel.ActiveWorkBook.Saved = 1                       ; Simulate a save of the Workbook
   
Else
   Exit(@ScriptLineNumber)
EndIf

#cs
Do
   Sleep(25)
Until NOT $oExcel.Application.Visible
      
$oXLApp = 0
Exit
#ce


Do
   Sleep(25)
   $msg = GUIGetMsg()
Until $msg = $GUI_EVENT_CLOSE

$oExcel.Quit

Func Error()
   $LineNum = @exitCode
   If $LineNum > 0 Then MsgBox(48, 'AutoIt Error', 'Script failed at line number ' & $LineNum & '.')
EndFunc
Edited by SlimShady

Share this post


Link to post
Share on other sites



bump...

i would like to see this too

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Mmmmh ....

...... perhaps far away from that what you wanted, but it should be possible using an extra DLL. Some weeks ago I saw a discussion to view IE pages on a GUI with a special DLL. I tested it with PDFs, works fine. Should also work with Excel files.

HTH, Reinhard

Edited by ReFran

Share this post


Link to post
Share on other sites

Mmmmh ....

...... perhaps far away from that what you wanted, but it should be possible using an extra DLL. Some weeks ago I saw a discussion to view IE pages on a GUI with a special DLL. I tested it with PDFs, works fine. Should also work with Excel files.

HTH, Reinhard

could you post the code you used to embed pdf's? i think that's something that could be useful to others in the future

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

Hi,

attached the code. It works also with an xls file, but it is slow, because Excel starts up so slow. So with xls it would be better to use a xls-viewer.

Please search here for the extra dll "cwebpage" you need to execute the code.

Best regards, Reinhard

#include "GUIConstants.au3"

$dll = DLLOpen("cwebpage.dll")

$hwnd = GUICreate("Browzer",600,600,-1,-1,$WS_SIZEBOX+$WS_SYSMENU)

$pos = WinGetClientSize($hwnd)

DLLCall($dll,"long","EmbedBrowserObject","hwnd",$hwnd)

GUISetState()

DLLCall($dll,"long","DisplayHTMLPage","hwnd",$hwnd,"str","file://c:\Test.pdf")

While 1

$msg = GUIGetMsg()

If $msg = -3 Then ExitLoop

$newpos = WinGetClientSize($hwnd)

If Not @error And $newpos[0] <> $pos[0] And _

$newpos[1] <> $pos[1] Then

$pos = $newpos

DLLCall($dll,"none","ResizeBrowser","hwnd",$hwnd,"int",$pos[0],"int",$pos[1])

EndIf

WEnd

$ret = DLLCall($dll,"long","UnEmbedBrowserObject","hwnd",$hwnd)

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