List Info

Thread: Re: Fwd: Inserting an embedded image at a bookmark position




Re: Fwd: Inserting an embedded image at a bookmark position
user name
2007-02-13 10:11:34
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 <sospmgroup.be>:
>
> have a look at
>
>
> http://www.oooforum.org/f
orum/viewtopic.phtml?t=14348&highlight=bookmark+viewcurs
or
> <
> http://www.oooforum.org/f
orum/viewtopic.phtml?t=14348&highlight=bookmark+viewcurs
or
> >
>
> 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: dev-unsubscribeapi.openoffice.org
> For additional commands, e-mail: dev-helpapi.openoffice.org
>
>


-- 
__________________________________________________________
"O único lugar onde o sucesso vem antes que o trabalho
é no dicionário"
Re: Fwd: Inserting an embedded image at a bookmark position
user name
2007-02-13 10:27:58
New problem...
When the bookmark is inside a table it doesn't work :(
any ideia?

2007/2/13, Rui Lima <eng.ruilimagmail.com>:
>
> 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 <sospmgroup.be>:
> >
> > have a look at
> >
> >
> > http://www.oooforum.org/f
orum/viewtopic.phtml?t=14348&highlight=bookmark+viewcurs
or
> > <http://www.oooforum.org/f
orum/viewtopic.phtml?t=14348&highlight=bookmark+viewcurs
or
> > >
> >
> > 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: dev-unsubscribeapi.openoffice.org
> > For additional commands, e-mail: dev-helpapi.openoffice.org
> >
> >
>
>
> --
>
__________________________________________________________
> "O único lugar onde o sucesso vem antes que o
trabalho é no dicionário"
>



-- 
__________________________________________________________
"O único lugar onde o sucesso vem antes que o trabalho
é no dicionário"
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )