CreateObjectEmbeddedΒΆ
CreateObjectEmbedded creates an object that can be embedded into a UniPlot document page.
- hOleItem = CreateObjectEmbedded(ssServer, hDoc)
Return Value
hOleItem is the handle of an OLE object
Parameters
- ssServerName
ssServerName is the server name, e.g.
"Excel.Sheet"
.
- hDoc
hDoc is the document handle in which the OLE object is embedded.
Example
The following example expects that you have Excel 2000 of Excel 97 installed.
def TestExcel()
{
hDoc = DocCreate()
hPage = PageCreate()
DocAddPage(hDoc, hPage)
hLayer = PageGetAllLayers(hPage)[1]
hExcel = CreateObjectEmbedded("Excel.Sheet", hDoc);
LayerAddObjects(hLayer, hExcel);
objXL = GetObject(hExcel);
objXL.ActiveSheet.Cells(1, 1).Value = "x"
objXL.ActiveSheet.Cells(1, 1).HorizontalAlignment = -4108; // xlCenter
objXL.ActiveSheet.Cells(1, 1).Interior.Color = XL_RGB(197, 197, 197);
objXL.ActiveSheet.Cells(1, 1).Borders.LineStyle = 1
objXL.ActiveSheet.Cells(1, 2).Value = "y"
objXL.ActiveSheet.Cells(1, 2).HorizontalAlignment = -4108; // xlCenter
objXL.ActiveSheet.Cells(1, 2).Interior.Color = XL_RGB(197, 197, 197);
objXL.ActiveSheet.Cells(1, 2).Borders.LineStyle = 1
objXL.ActiveSheet.Range("A2:A6").Value = [1:5]'
objXL.ActiveSheet.Range("B2:B6").Value = sin([1:5]')
OBJSetPosSize(hExcel, [3, -8, 5, 2.8])
PageReplot(hPage)
}
See also
id-1052351