OOobbs3/34
質問
お世話になります。 下記Codeにて、Title & OjectのSlideをmacroにて作成しようと試みております。 しかしながら、Macroは最後までError無く実行されるのですが、入力した値や文字がSlide画面に表示されません。 OLE2ShapeをDouble ClickするとCalcが起動して、入力した値や文字列が表示されますが、終了するとやはり表示されません。 Slide showを実行しても表示されません。 つきましては、Macro実行後にSlide画面及びSlide Showにて表示される方法をご教示頂けます様お願いします。 ******** [ Code ] ********** Sub oPageImpress Dim oDoc Dim oPage Dim Dummy() oDoc = StarDesktop.loadComponentFromURL("private:factory/simpress", "_blank", 0, Dummy()) oPage = oDoc.getDrawPages().getByIndex(0) ' oPage.Layout = 11 ' oShapeNum = oPage.getCount - 1 ' Dim oShape for i = 0 to oShapeNum oShape = oPage.getByIndex(i) If oShape.supportsService("com.sun.star.presentation.TitleTextShape") then oShape.setString("Slide 1 / TitleTextShape") End If ' If oShape.getShapeType = "com.sun.star.presentation.OLE2Shape" then ' Calc Object oShape.CLSID = "47bbb4cb-ce4c-4e80-a591-42d9ae74950f" ' Dim oEmbeded Dim oOLEComponent Dim oCalcSheets Dim oObj oEmbedded = oShape.EmbeddedObject oOLEComponent = oEmbedded.getComponent() oCalcSheets = oOLEComponent.getSheets() oObj = oCalcSheets.getByIndex( 0 ) oObj.getCellByPosition(0,0).String = "OLE Calc Document in Impress" oObj.getCellByPosition(0,1).Value = 10 oObj.getCellByPosition(0,2).Value = 20 oObj.getCellByPosition(0,3).Formula = "=A2+A3" ' End If next i msgbox "Success" End Sub ******************************************** 回答
感想,コメント,メモ
ご教示ありがとうございました。ご指摘通り com.sun.star.presentation.OLE2Shape => Slideに表示されない。 com.sun.star.drawing.OLE2Shape => Slideに表示される。 でした。最終的なCodeを以下に記しますので本Siteの糧に少しでもなれば幸いです。 ******** [ Code ] ************** Sub oImpShape Dim oDoc Dim oImpPage Dim oPoint as new com.sun.star.awt.Point Dim oSize as new com.sun.star.awt.Size Dim oIShape Dim Dummy() oDoc = StarDesktop.loadComponentFromURL("private:factory/simpress", "_default", 0, Dummy()) oImpPage = oDoc.getDrawPages().getByIndex(0) oImpPage.Layout = 20 ' ' TitleTextShape 'Position oPoint.X = 1000 oPoint.Y = 1000 'Size 'Get page size oPageH = oImpPage.Height oPageW = oImpPage.Width ' Shape Size oSize.Height = 5000 ' unit : 1/100 mm oSize.Width = oPageW - 1000*2 ' Instance oIShape = oDoc.createInstance("com.sun.star.presentation.TitleTextShape") oIShape.setPosition(oPoint) oIShape.setSize(oSize) oIShape.LineStyle = com.sun.star.drawing.LineStyle.SOLID oImpPage.add(oIShape) oIShape.setString("TitleTextShape") ' ' ' OLE2Shape 'Position oPoint.X = 1000 oPoint.Y = 6500 'Size ' Shape Size oSize.Height = 10000 ' unit : 1/100 mm oSize.Width = oPageW - 1000*2 ' Instance oIShape = oDoc.createInstance("com.sun.star.drawing.OLE2Shape") ' Calc oIShape.CLSID = "47bbb4cb-ce4c-4e80-a591-42d9ae74950f" oIShape.setPosition(oPoint) oIShape.setSize(oSize) oImpPage.add(oIShape) ' ' Dim oEmbeded Dim oOLEComponent Dim oCalcSheets Dim oObj oEmbedded = oIShape.EmbeddedObject oOLEComponent = oEmbedded.getComponent() oCalcSheets = oOLEComponent.getSheets() oObj = oCalcSheets.getByIndex(0) oObj.getCellByPosition(0,0).String = "OLE Calc Document in Impress" oObj.getCellByPosition(0,1).Value = 10 oObj.getCellByPosition(0,2).Value = 20 oObj.getCellByPosition(0,3).Formula = "=A2+A3" End Sub ******************************** |