OpenOffice Error vnd.sun.star.GraphicObject

随声附和 提交于 2019-12-12 04:32:08

问题


I am trying to display an image from a SpreadSheet(OpenOffice) into my PictureBox control and here is my code.

Dim objServiceManager As Object
Dim objDesktop        As Object
Dim objDocument       As Object
Dim objText           As Object
Dim objCursor         As Object
Dim oDoc              As Object
Dim ARG()
Dim oGraph    As Object
Dim oView     As Object
Dim oDrawPage As Object
Dim oSheet    As Object
Dim oimage    As Object
Dim osize     As Object
Dim Cell      As Object
Dim GraphURL As String

Set objServiceManager = CreateObject("com.sun.star.ServiceManager")
Set objDesktop = objServiceManager.createInstance("com.sun.star.frame.Desktop")
Set osize = objServiceManager.Bridge_GetStruct("com.sun.star.awt.Size")
Set opos = objServiceManager.Bridge_GetStruct("com.sun.star.awt.Point")
Set oDoc = objDesktop.loadComponentFromURL("file:///C:\Users\paul\Desktop\ACE Express - Fairview_Sample PC of Gondola.ods", "_blank", 0, ARG())
Set oSheet = oDoc.getSheets().getByIndex(0)
Set oimage = oDoc.createInstance("com.sun.star.drawing.GraphicObjectShape")
Set oView = oDoc.CurrentController
Set oDrawPage = oView.getActiveSheet.DrawPage
Set oControl = oDoc
Set oDrawPage = oDoc.getDrawPages().getByIndex(0)
Set oimage = oDrawPage.getByIndex(0)

Image1.Picture = LoadPicture(oimage.GraphicURL)

But sad to say I have this error

It is supposed to be that the image that will replace the image in my picturebox(Mountain.jpg) is this.

But it doesn't happen

Please take note of the following:

  • The spreadsheet used is OpenOffice Calc
  • Displaying the image inside Picturebox (VB6)

Update 2 The error comes from the code.

Image1.Picture = LoadPicture(oimage.GraphicURL)

来源:https://stackoverflow.com/questions/40986697/openoffice-error-vnd-sun-star-graphicobject

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!