.. highlightlang:: us .. index:: CreateObjectEmbedded .. _createobjectembedded: CreateObjectEmbedded ==================== .. us.tag CreateObjectEmbedded NOTREADYENGLISH Programming.ActiveX New300 :ref:`CreateObjectEmbedded` creates an object that can be embedded into a UniPlot document page. .. function:: hOleItem = CreateObjectEmbedded(ssServer, hDoc) .. us.return **Return Value** *hOleItem* is the handle of an OLE object .. us.params **Parameters** .. uparam:: ssServerName *ssServerName* is the server name, e.g. ``"Excel.Sheet"``. .. uparam:: hDoc *hDoc* is the document handle in which the OLE object is embedded. .. us.example **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) } .. seealso:: :ref:`overview-programming`, :ref:`CreateObject`, :ref:`GetObject`, :ref:`OLEDoVerb` :sub:`id-1052351`