ptrex Posted November 9, 2005 Share Posted November 9, 2005 (edited) Excel Grid in AutoITFor those who are interested in Excel.Helps you using Excel function and use the results of these back in AutoIT variables.Also this can be used as a replacement for the ListView, and load the data direct in the Excel Grid.Exporting to an Excel file is standard included (look at the toolbar icons).expandcollapse popup; ; Script generated by AutoBuilder 0.5 Prototype ; Embedded Excel Object in AutoIt ; Helps you using Excelfunction and use the results of these back in AutoIT vars. ; Also this can be used as a replacement for the ListView, and load the data direct in the Excel Grid. ; PTREX 09/11/05 ; #include <GUIConstants.au3> #NoTrayIcon ;Vars Dim $oMyError Dim $i Dim $j ;Declare objects $oExcel = ObjCreate("OWC10.spreadsheet"); Default to Office XP If not IsObj($oExcel) Then $oExcel = ObjCreate("OWC11.spreadsheet"); Office 2003 EndIf IF not IsObj($oExcel) Then $oExcel = ObjCreate("OWC00.spreadsheet"); Office 2000 EndIf If IsObj($oExcel) Then with $oExcel ;.Worksheets ("Sheet1").Activate ;.activesheet.range ("A1:B10").value = "TEST INFO" for $i = 1 to 15 for $j = 1 to 15 .cells($i,$j).value = $i next next EndWith Else MsgBox(0,"Reply","Not an Object",4) EndIf ;Main Gui GuiCreate("Excel Object", 802, 590,(@DesktopWidth-802)/2, (@DesktopHeight-590)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS) $GUI_ActiveX = GUICtrlCreateObj ($oExcel, 10, 10 , 780 , 550) GUICtrlSetStyle ( $GUI_ActiveX, $WS_VISIBLE ) GUICtrlSetResizing ($GUI_ActiveX,$GUI_DOCKAUTO) ; Auto Resize Object GuiSetState() While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd Exit ;This is Sven P's custom error handler Func MyErrFunc() $HexNumber=hex($oMyError.number,8) Msgbox(0,"AutoItCOM Test","We intercepted a COM Error !" & @CRLF & @CRLF & _ "err.description is: " & @TAB & $oMyError.description & @CRLF & _ "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _ "err.number is: " & @TAB & $HexNumber & @CRLF & _ "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _ "err.source is: " & @TAB & $oMyError.source & @CRLF & _ "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $oMyError.helpcontext _ ) SetError(1) ; to check for after this function returns EndfuncOffice 2003 object added.Enjoy Edited September 14, 2012 by ptrex genius257 1 Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
blink314 Posted November 9, 2005 Share Posted November 9, 2005 Tried your script... any ideas what the Excel object declaration should be for Office 2003? Thanks Kevin Link to comment Share on other sites More sharing options...
randallc Posted November 9, 2005 Share Posted November 9, 2005 OWC11.spreadsheet Randall ExcelCOM... AccessCom.. Word2... FileListToArrayNew...SearchMiner... Regexps...SQL...Explorer...Array2D.. _GUIListView...array problem...APITailRW Link to comment Share on other sites More sharing options...
blink314 Posted November 9, 2005 Share Posted November 9, 2005 Ahhhh... much thanks! Kevin Link to comment Share on other sites More sharing options...
blink314 Posted November 9, 2005 Share Posted November 9, 2005 Wow! That is really cool. Is there any way to customize the grid? Like get rid of the toolbar, make it non-resizable, write protect it, etc? I dont know much about objects (my only experience is with the SQL stuff). Or, is there a thread already started about the Excel object? Kevin Link to comment Share on other sites More sharing options...
ptrex Posted November 9, 2005 Author Share Posted November 9, 2005 I will add Office 2003 to the script. Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
maqleod Posted November 13, 2005 Share Posted November 13, 2005 Is there any chance that this could possibly be used with OpenOffice spreadsheets? or is it limited to excel? [u]You can download my projects at:[/u] Pulsar Software Link to comment Share on other sites More sharing options...
blink314 Posted November 14, 2005 Share Posted November 14, 2005 I just tried to use this with Office 2000 and got a Not an Object error. Any ideas? I have a liscenced version but I did not install everything (Outlook is not installed). Kevin Link to comment Share on other sites More sharing options...
randallc Posted November 14, 2005 Share Posted November 14, 2005 (edited) You're not in luck today! "OWC9.spreadsheet" randall Edited November 14, 2005 by randallc ExcelCOM... AccessCom.. Word2... FileListToArrayNew...SearchMiner... Regexps...SQL...Explorer...Array2D.. _GUIListView...array problem...APITailRW Link to comment Share on other sites More sharing options...
ptrex Posted November 14, 2005 Author Share Posted November 14, 2005 (edited) @blink314You need outlook to be installed in order to have this feature available.OWC stands for Office Web Components.PS: I have added this to my SQLite example, so that data can be exported from the LV to this Excel Object directly. This can be incorporated into you database.au3 project. I can do this for you if you want. Let me know.@randallcHi I see that you trying to help out here. That's nice I appreciate this. Thanks.Like I said above. I finalized an Listview export to this Excel object. I will post the new code in the SQLite example post.@maqleodCan this be used for OpenOffice spreadsheets ?It can but it all depends what you want to do with it. If you want to read data from an OpenOffice spreadsheet or do you want to export to an OpenOffice Spreadsheet. Export to an OO spreadsheet is simple because OO can read Excel format. To export press EXPORT 2 XLS button in the toolbar save it, and open this files later using OO Spreadsheet.To import data from OO spreadsheet, this might be possible but I don' t know the tips and trics to do it right away.Look here for the updated code including export to OWC Excel object.http://www.autoitscript.com/forum/index.ph...mp;#entry123791Enjoy. Edited May 19, 2008 by ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
litlmike Posted November 7, 2006 Share Posted November 7, 2006 This is awesome! I gotta find something to use this for. _ArrayPermute()_ArrayUnique()Excel.au3 UDF Link to comment Share on other sites More sharing options...
Locodarwin Posted November 8, 2006 Share Posted November 8, 2006 For programming information regarding this embedded object, check out this file, which should be installed on any system that has the OWC set installed: OWCDSS11.CHM Down towards the bottom, there is a section called "Programming Information," which describes all of the properties, methods, collections, etc. supported by the OWC Spreadsheet component. This should help you find the information you're looking for, Blink314. With this object you can do most if not all of the things you were asking about. -S (Yet Another) ExcelCOM UDF"A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly...[indent]...specialization is for insects." - R. A. Heinlein[/indent] Link to comment Share on other sites More sharing options...
ptrex Posted November 8, 2006 Author Share Posted November 8, 2006 @litlmike I PM you about the sorting using the ADOR.Recordset. But of course if you use the EXCEL Grid, you have all the native sorting options available in the grid. Up to you what you like best. regards, ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
Radsam Posted November 14, 2006 Share Posted November 14, 2006 Can this be done for opening an existing excel document instead of creating a new one? Link to comment Share on other sites More sharing options...
Locodarwin Posted November 14, 2006 Share Posted November 14, 2006 Unfortunately, no. You cannot open an existing workbook or sheet into this component, at least not directly. You can, however, attach it to an external data source, and in doing so it would be possible to pull data from an existing workbook. It's not a simple task, however, and you'd likely be better off just C&P from the existing workbook into the new OWC.Spreadsheet. Exporting from this component is rather straightforward, though there are limitations in how much/what kind of data can be exported. -S (Yet Another) ExcelCOM UDF"A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly...[indent]...specialization is for insects." - R. A. Heinlein[/indent] Link to comment Share on other sites More sharing options...
Radsam Posted November 14, 2006 Share Posted November 14, 2006 Thanks, that works great. Link to comment Share on other sites More sharing options...
Will66 Posted March 9, 2007 Share Posted March 9, 2007 Tried your script... any ideas what the Excel object declaration should be for Office 2003? Thanks Kevin A machine at work has office 97 on it so will test it tommorow, but this is working for me using VersionIndependentProgID: "OWC.Spreadsheet" expandcollapse popup#include <GUIConstants.au3> $Form1 = GUICreate("AForm1", 600, 600, 193, 115,$WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPCHILDREN ) GUISetState(@SW_SHOW) $Obj1 = ObjCreate("OWC.Spreadsheet") ;$Obj1.visible=1 $Obj1_ctrl = GUICtrlCreateObj($Obj1,20, 20,500,500) With $Obj1 .AutoFit=0 .DisplayColHeaders=-1 .DisplayGridlines=-1 .DisplayHorizontalScrollBar=-1 .DisplayRowHeaders=-1 .DisplayTitleBar=-0 .DisplayToolbar=0 .DisplayVerticalScrollBar=-1 .EnableAutoCalculate=-1 .EnableEvents=-1 .MoveAfterReturn=-1 .MoveAfterReturnDirection=0 .RightToLeft=0 ;.ViewableRange="1:65536" EndWith With $Obj1 .cells(1,1).value = "hello world" ;.range("A1:B2").clear Endwith While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Link to comment Share on other sites More sharing options...
SandelPerieanu Posted September 27, 2007 Share Posted September 27, 2007 A machine at work has office 97 on it so will test it tommorow, but this is working for me using VersionIndependentProgID: "OWC.Spreadsheet" expandcollapse popup#include <GUIConstants.au3> $Form1 = GUICreate("AForm1", 600, 600, 193, 115,$WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPCHILDREN ) GUISetState(@SW_SHOW) $Obj1 = ObjCreate("OWC.Spreadsheet") ;$Obj1.visible=1 $Obj1_ctrl = GUICtrlCreateObj($Obj1,20, 20,500,500) With $Obj1 .AutoFit=0 .DisplayColHeaders=-1 .DisplayGridlines=-1 .DisplayHorizontalScrollBar=-1 .DisplayRowHeaders=-1 .DisplayTitleBar=-0 .DisplayToolbar=0 .DisplayVerticalScrollBar=-1 .EnableAutoCalculate=-1 .EnableEvents=-1 .MoveAfterReturn=-1 .MoveAfterReturnDirection=0 .RightToLeft=0 ;.ViewableRange="1:65536" EndWith With $Obj1 .cells(1,1).value = "hello world" ;.range("A1:B2").clear Endwith While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd how i can open a file *.xls with owc11 ? thanks Link to comment Share on other sites More sharing options...
ptrex Posted September 27, 2007 Author Share Posted September 27, 2007 @psando.ro This is not intended to be used for opening an XLS file. But if you insist on opening a file to load into the XLS object you will have to use this. $Spreadsheet1.XMLURL = "http://example.microsoft.com/Test.xml" regards, ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
Eigensheep Posted May 16, 2008 Share Posted May 16, 2008 (edited) Can you access the object as a regular COM object? I don't seem to be able to use it for anything. Edited May 17, 2008 by NumberDaemon Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now