Posted: Wed Feb 25, 2009 1:40 pm
@ srod
Maybe a little Off-Topic but in the german board kiffi posted a create further example for using COMate. The example goes around using the excel chart and excel spreadsheet from Microsoft. Its neccessary that you have installed Excel and the OWC.....Dll (Office web Components). Maybe you will put this code to the example collection of the COMate download file:
The original thread in the german board: http://www.purebasic.fr/german/viewtopi ... sc&start=0
Maybe a little Off-Topic but in the german board kiffi posted a create further example for using COMate. The example goes around using the excel chart and excel spreadsheet from Microsoft. Its neccessary that you have installed Excel and the OWC.....Dll (Office web Components). Maybe you will put this code to the example collection of the COMate download file:
Code: Select all
XIncludeFile "COMate_Residents.pbi"
XIncludeFile "COMate.pbi"
ExcelObject.COMateObject
ExcelObject1.COMateObject
If OpenWindow(0,#PB_Ignore,#PB_Ignore,800,800,"COMate: OWC11.Spreadsheet-Demo",#PB_Window_Invisible|#PB_Window_SystemMenu)
ExcelObject=COMate_CreateActiveXControl(0,0,800,400,"OWC11.Spreadsheet")
If ExcelObject
ExcelObject\SetProperty("Cells(1,1) = 'Özgür'")
ExcelObject\SetProperty("Cells(1,2) = 'Levent'")
ExcelObject\SetProperty("Cells(2,1) = 10")
ExcelObject\SetProperty("Cells(2,2) = 20")
ExcelObject\SetProperty("Cells(1, 1)\Interior\Color = 18915966")
ExcelObject\SetProperty("Cells(1, 2)\Interior\Color = 18915966")
ExcelObject\SetProperty("Cells(2, 1)\Interior\Color = 18915966")
ExcelObject\SetProperty("Cells(2, 2)\Interior\Color = 18915966")
ExcelObject\SetProperty("Cells(1, 1)\Font\Color = 255255255")
ExcelObject\SetProperty("Cells(1, 2)\Font\Color = 255255255")
ExcelObject\SetProperty("Cells(2, 1)\Font\Color = 255255255")
ExcelObject\SetProperty("Cells(2, 2)\Font\Color = 255255255")
ExcelObject\GetObjectProperty("Sheets('3')\Delete")
ExcelObject\GetObjectProperty("Sheets('2')\Delete")
ExcelObject\SetProperty("Cells(1, 1)\HorizontalAlignment = -4152") ;-4152 = xlRight
ExcelObject\SetProperty("Cells(1, 2)\HorizontalAlignment = -4152") ;-4152 = xlRight
ExcelObject\SetProperty("Cells(2, 1)\HorizontalAlignment = -4152") ;-4152 = xlRight
ExcelObject\SetProperty("Cells(2, 2)\HorizontalAlignment = -4152") ;-4152 = xlRight
ExcelObject\SetProperty("Cells(1, 1)\Borders(7)\LineStyle = 1") ;7 = xlEdgeLeft ; 1 = xlContinuous
ExcelObject\SetProperty("Cells(1, 1)\Borders(8)\LineStyle = 1") ;8 = xlEdgeTop ; 1 = xlContinuous
ExcelObject\SetProperty("Cells(1, 1)\Borders(9)\LineStyle = 1") ;9 = xlEdgeBottom ; 1 = xlContinuous
ExcelObject\SetProperty("Cells(1, 1)\Borders(10)\LineStyle = 1") ;10 = xlEdgeRight ; 1 = xlContinuous
ExcelObject\SetProperty("Cells(1, 2)\Borders(7)\LineStyle = 1") ;7 = xlEdgeLeft ; 1 = xlContinuous
ExcelObject\SetProperty("Cells(1, 2)\Borders(8)\LineStyle = 1") ;8 = xlEdgeTop ; 1 = xlContinuous
ExcelObject\SetProperty("Cells(1, 2)\Borders(9)\LineStyle = 1") ;9 = xlEdgeBottom ; 1 = xlContinuous
ExcelObject\SetProperty("Cells(1, 2)\Borders(10)\LineStyle = 1") ;10 = xlEdgeRight ; 1 = xlContinuous
ExcelObject\SetProperty("Cells(2, 1)\Borders(7)\LineStyle = 1") ;7 = xlEdgeLeft ; 1 = xlContinuous
ExcelObject\SetProperty("Cells(2, 1)\Borders(8)\LineStyle = 1") ;8 = xlEdgeTop ; 1 = xlContinuous
ExcelObject\SetProperty("Cells(2, 1)\Borders(9)\LineStyle = 1") ;9 = xlEdgeBottom ; 1 = xlContinuous
ExcelObject\SetProperty("Cells(2, 1)\Borders(10)\LineStyle = 1") ;10 = xlEdgeRight ; 1 = xlContinuous
ExcelObject\SetProperty("Cells(2, 2)\Borders(7)\LineStyle = 1") ;7 = xlEdgeLeft ; 1 = xlContinuous
ExcelObject\SetProperty("Cells(2, 2)\Borders(8)\LineStyle = 1") ;8 = xlEdgeTop ; 1 = xlContinuous
ExcelObject\SetProperty("Cells(2, 2)\Borders(9)\LineStyle = 1") ;9 = xlEdgeBottom ; 1 = xlContinuous
ExcelObject\SetProperty("Cells(2, 2)\Borders(10)\LineStyle = 1") ;10 = xlEdgeRight ; 1 = xlContinuous
ExcelObject\SetProperty("Cells(1, 1)\Borders(7)\Weight = 2") ;2 = xlThin
ExcelObject\SetProperty("Cells(1, 1)\Borders(8)\Weight = 2") ;2 = xlThin
ExcelObject\SetProperty("Cells(1, 1)\Borders(9)\Weight = 2") ;2 = xlThin
ExcelObject\SetProperty("Cells(1, 1)\Borders(10)\Weight = 2") ;2 = xlThin
ExcelObject\SetProperty("Cells(1, 2)\Borders(7)\Weight = 2") ;2 = xlThin
ExcelObject\SetProperty("Cells(1, 2)\Borders(8)\Weight = 2") ;2 = xlThin
ExcelObject\SetProperty("Cells(1, 2)\Borders(9)\Weight = 2") ;2 = xlThin
ExcelObject\SetProperty("Cells(1, 2)\Borders(10)\Weight = 2") ;2 = xlThin
ExcelObject\SetProperty("Cells(2, 1)\Borders(7)\Weight = 2") ;2 = xlThin
ExcelObject\SetProperty("Cells(2, 1)\Borders(8)\Weight = 2") ;2 = xlThin
ExcelObject\SetProperty("Cells(2, 1)\Borders(9)\Weight = 2") ;2 = xlThin
ExcelObject\SetProperty("Cells(2, 1)\Borders(10)\Weight = 2") ;2 = xlThin
ExcelObject\SetProperty("Cells(2, 2)\Borders(7)\Weight = 2") ;2 = xlThin
ExcelObject\SetProperty("Cells(2, 2)\Borders(8)\Weight = 2") ;2 = xlThin
ExcelObject\SetProperty("Cells(2, 2)\Borders(9)\Weight = 2") ;2 = xlThin
ExcelObject\SetProperty("Cells(2, 2)\Borders(10)\Weight = 2") ;2 = xlThin
ExcelObject\SetProperty("DisplayToolbar = #False")
ExcelObject\SetProperty("ScreenUpdating = #True")
ExcelObject\SetProperty("ViewOnlyMode = #True") ;Schreibschutz
ExcelObject\SetProperty("DisplayOfficeLogo = #False")
ExcelObject\SetProperty("DisplayTitleBar = #False")
ExcelObject\SetProperty("ActiveWindow\ViewableRange = 'A1:B2'")
ExcelObject\SetProperty("ActiveWindow\DisplayWorkbookTabs = #False")
Else
Debug "!mySpreadsheet"
EndIf
;##############################################################
Define myChart.COMateObject
Define ChartSpace.COMateObject
Define mySeriesCollection.COMateObject
ChartSpace=COMate_CreateActiveXControl(0,400,800,400,"OWC11.ChartSpace")
If ChartSpace
ChartSpace\SetProperty("DisplayOfficeLogo = #False")
ChartSpace\SetProperty("DisplayToolbar = #False")
ChartSpace\SetProperty("AllowPropertyToolbox = #False")
ChartSpace\SetProperty("ScreenUpdating = #True")
ChartSpace\SetProperty("HasChartSpaceTitle = #True")
ChartSpace\SetProperty("ChartSpaceTitle\Caption = 'Overview'")
ChartSpace\SetProperty("ChartSpaceTitle\Font\Bold = #True")
ChartSpace\SetProperty("ChartSpaceTitle\Font\Underline = #True")
ChartSpace\SetProperty("SeriesCollection\Type = 6") ;6=chChartTypeLine
ChartSpace\SetProperty("DataSource = " + Str(ExcelObject) + " As COMateObject")
myChart = ChartSpace\GetObjectProperty("Charts\Add")
If myChart
myChart\SetProperty("Type = 6") ; 6 = chChartTypeLine
mySeriesCollection = myChart\GetObjectProperty("SeriesCollection\Add")
If mySeriesCollection
mySeriesCollection\Invoke("SetData( 0, 0, 'B1')") ;0 = chDimSeriesNames
mySeriesCollection\Invoke("SetData( 1, 0, 'A1:B1')") ;1 = chDimCategories
mySeriesCollection\Invoke("SetData( 2, 0, 'A2:B2')") ;2=chDimValues
mySeriesCollection\Release()
Else
Debug "!mySeriesCollection"
EndIf
myChart\Release()
Else
Debug "!myChart"
EndIf
EndIf
HideWindow(0,0)
If ExcelObject
Repeat
Until WaitWindowEvent()=#PB_Event_CloseWindow
ExcelObject\Release()
ChartSpace\Release()
EndIf
CloseWindow(0)
EndIf