Ask Your Question
0

Highlight bookmarks [closed]

asked 2017-09-02 06:16:55 +0200

Tass gravatar image

Hi! I am using Zotero as a reference manager in Writer. To make my documents compatible with Word, Zotero offers the option to insert citations as bookmarks instead of fields. The problem I have is, I am working on a large document with contributions from many people, using different ref managers etc. when integrating these contributions the reference links normally break but the citation is still in the text. So I have now text with the citations I inserted properly linked to my Zotero and those of others just being text or fields with no connection anymore. It would be really helpful if writer would highlight bookmarked text so I could immediately see which citations will show up in the Bibliography and which are broken.

I know that you can navigate manually through bookmarks, but with hundreds of bookmarks this is not an option.

Please tell me that you can highlight bookmarks the same way you can highlight fields... PLEASEEEEE.

Cheers, T.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Tass
close date 2018-07-09 18:13:15.179326

2 Answers

Sort by » oldest newest most voted
1

answered 2017-09-02 08:52:19 +0200

JBF gravatar image

updated 2017-09-02 14:19:29 +0200

Enhancement request already filed : https://bugs.documentfoundation.org/s... You can comment this bug report to add your own proposition how to make bookmarks visible.

You should try this extension: https://extensions.libreoffice.org/ex...

edit flag offensive delete link more

Comments

Hey, thanks a lot. It looked good at the beginning but then it started to show 20 or more comment windows per bookmark making writer so slow that I already thought it had crashed. So this tool is only an option if there is really nothing else available. Still at least some kind of help, better than nothing.

Tass gravatar imageTass ( 2017-09-02 16:14:12 +0200 )edit
0

answered 2017-09-02 15:00:01 +0200

librebel gravatar image

updated 2017-09-03 10:43:48 +0200

Hello @Tass,

please try if the following macro works in your case:

Sub HighlightAllBookmarks( lHighLightColor As Long )
REM Highlights all Bookmarked text strings from the current document.
REM Example:  HighlightAllBookmarks( RGB(19,240,55) )
    If HasUnoInterfaces( ThisComponent, "com.sun.star.text.XBookmarksSupplier" ) Then
        Dim oBookmarks As Object
        oBookmarks = ThisComponent.getBookmarks()

        Dim sBookMarkNames() As String
        sBookMarkNames = oBookmarks.getElementNames()

        Dim i As Integer
        For i = 0 To Ubound( sBookMarkNames )
            oBookmarks.getByName( sBookMarkNames( i ) ).getAnchor().CharBackColor = lHighLightColor
        Next
    End If
End Sub

Sub HighlightAllBookmarks_Green()
    HighlightAllBookmarks( RGB(19,240,55) )
End Sub
edit flag offensive delete link more

Comments

Hi, thanks a lot, wow, what a service! I tried it, opened the document in Writer, then the macro editor, copied all in, saved, ran it, got the following message: BASIC runtime error. Argument is not optional. and highlights this line: oBookmarks.getByName( sBookMarkNames( i ) ).getAnchor().CharBackColor = lHighLightColor

I have no clues about macros, last time I programmed something lies decades back, so sorry if I behave a bit dumb.

Tass gravatar imageTass ( 2017-09-02 16:04:29 +0200 )edit

When I run it outside the editor I get this message: A Scripting Framework error occurred while running the Basic script Standard.Module1.HighlightAllBookmarks. Message: wrong number of parameters!

Tass gravatar imageTass ( 2017-09-02 16:05:08 +0200 )edit

To call the above macro without argument:

Sub HighlightAllBookmarks_Green()
    HighlightAllBookmarks( RGB(19,240,55) )
End Sub
librebel gravatar imagelibrebel ( 2017-09-02 16:54:42 +0200 )edit

Hey, thanks! Returns now: BASIC runtime error. Sub-procedure or function procedure not defined. And it marks: HighlightAllBookmarks( RGB(19,240,55) ) But I also don't know if I copied it well, I made it to replace the first line of what you send me first.

Tass gravatar imageTass ( 2017-09-03 09:43:42 +0200 )edit

The second Sub does not replace the first Sub that i posted, but you need to have both Subs for this to work. ( both HighlightAllBookmarks and HighlightAllBookmarks_Green ).

I updated my answer to show them both together.

librebel gravatar imagelibrebel ( 2017-09-03 10:42:45 +0200 )edit

Question Tools

1 follower

Stats

Asked: 2017-09-02 06:16:55 +0200

Seen: 244 times

Last updated: Sep 03 '17