Thanks Fernand i've created the following sub
Sub ViewCursorGotoBookMark(ByVal aDocument As XComponent, ByVal
strBookMarkName As String)
Dim MyBookMark As XTextContent
MyBookMark = GetBookmarkByName(aDocument, strBookMarkName)
Dim MyViewCursor As XTextViewCursor
MyViewCursor = DirectCast(DirectCast(aDocument,
XTextDocument).getCurrentController, XTextViewCursorSupplier).getViewCursor
MyViewCursor.gotoRange(MyBookMark.getAnchor(), False)
End Sub
Now it inserts at the bookmark position, Could you please tell me how can i
horizontally center the image on the page???
By the way the use of the funtions, for the ones who needs is:
ViewCursorGotoBookMark(objDocument, "bkImage")
InsertImage(objDocument, strImagem, MyWidth, MyHeight)
Hope it helps others....
2007/2/13, Fernand Vanrie <[EMAIL PROTECTED]>:
have a look at
http://www.oooforum.org/forum/viewtopic.phtml?t=14348&highlight=bookmark+viewcursor
<
http://www.oooforum.org/forum/viewtopic.phtml?t=14348&highlight=bookmark+viewcursor
>
Rui Lima wrote:
> I have the following code to insert an embedded image on a WriterFile.
> The
> code is VB.NET
>
>
> Dim MyDispatcher As XDispatchHelper = MyMServiceFactory.createInstance("
> com.sun.star.frame.DispatchHelper")
> Dim MyProp(3) As unoidl.com.sun.star.beans.PropertyValue
> MyProp(0) = MakePropertyValue("FileName", strImgFileName)
> MyProp(1) = MakePropertyValue("AsLink", False)
> MyProp(2) = MakePropertyValue("Style", "Image")
>
> Dim an As unoidl.com.sun.star.frame.DispatchResultEvent = DirectCast(
> MyDispatcher.executeDispatch(aDocument.getCurrentController.getFrame,
> ".uno:InsertGraphic", "", 0, MyProp).Value,
> unoidl.com.sun.star.frame.DispatchResultEvent)
>
> Dim MyController As XController = aDocument.getCurrentController
> Dim MySelecionSupplier As XSelectionSupplier = DirectCast(MyController,
> XSelectionSupplier)
> Dim selection As uno.Any = MySelecionSupplier.getSelection
> Dim sel As unoidl.com.sun.star.drawing.XShape = selection.Value
>
> Dim strShapeType As String = sel.getShapeType
> ' Dim pos As unoidl.com.sun.star.awt.Point = sel.getPosition
> sel.setSize(New unoidl.com.sun.star.awt.Size(SizeWidth, SizeHeight))
>
>
> But i still have a problem with it... How can i set the position to a
> BookMark position???
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
__________________________________________________________
"O único lugar onde o sucesso vem antes que o trabalho é no dicionário"