# Highlight text snippets in WOPI application ideally in view mode

**URL:** <https://forum.collaboraonline.com/t/highlight-text-snippets-in-wopi-application-ideally-in-view-mode/3840>\
**Category:** Development\
**Created:** [July 4, 2025, 1:41pm UTC](https://forum.collaboraonline.com/t/highlight-text-snippets-in-wopi-application-ideally-in-view-mode/3840 "2025-07-04T13:41:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![pakue](https://avatars.discourse-cdn.com/v4/letter/p/f0a364/32.png) [@pakue](https://forum.collaboraonline.com/u/pakue)\
**Post date:** [July 4, 2025, 1:41pm UTC](https://forum.collaboraonline.com/t/highlight-text-snippets-in-wopi-application-ideally-in-view-mode/3840/1 "2025-07-04T13:41:11Z")

</div>

Hey all,

I’m trying to integrate the Collabora WOPI Editor in a web app while also highlighting text snippets of interest for the user.  
The snippets are coming from a RAG backend, so I can’t influence them.

Is there a way to implement this functionality via post messages and UNO commands while keeping the editor in view mode?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![darshan](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.collaboraonline.com/darshan/32/2230_2.png) [@darshan](https://forum.collaboraonline.com/u/darshan)\
**Post date:** [July 7, 2025, 7:17am UTC](https://forum.collaboraonline.com/t/highlight-text-snippets-in-wopi-application-ideally-in-view-mode/3840/2 "2025-07-07T07:17:54Z")

</div>

hii @pakue welcome to community forum 🙂

No, directly highlighting text snippets in Collabora WOPI view mode using PostMessages and UNO commands for persistent, document-embedded highlights is generally not possible. View mode prevents document modifications. You would likely need to explore external UI overlays, which are complex, or temporarily switch to edit mode if acceptable.

Explanation:

- View Mode Restriction: Collabora’s WOPI view mode (`UserCanWrite: false`) is designed to prevent any document modifications, including applying formatting like highlights. UNO commands for highlighting, even if sent, will likely be ignored or not persist.
- External UI/Overlay: The most feasible approach is to overlay your own highlighting UI on top of the Collabora iframe, but this requires complex coordinate mapping to match text positions.

Although @pakue i see we have `ExecuteSearch` UNO comand that works to heiglight the text in read only mode but there is no post message api for that. But you can explore more options around it…

Thanks  
Darshan

---

<div class="post-metadata">

**Author:** ![pakue](https://avatars.discourse-cdn.com/v4/letter/p/f0a364/32.png) [@pakue](https://forum.collaboraonline.com/u/pakue)\
**Post date:** [July 7, 2025, 2:21pm UTC](https://forum.collaboraonline.com/t/highlight-text-snippets-in-wopi-application-ideally-in-view-mode/3840/3 "2025-07-07T14:21:19Z")

</div>

Hey @darshan,  
thanks for the reply. I’ve played around with some of the commands stated [here](https://wiki.documentfoundation.org/Development/DispatchCommands) including the `ExecuteSearch` with the following PostMessage:

```auto
{
    "MessageId": "Send_UNO_Command",
    "SendTime": 1751897618184,
    "Values": {
        "Command": ".uno:ExecuteSearch",
        "Args": {
            "SearchItem": {
                "value": "randomstring",
                "type": "string"
            },
            "UseAttrItemList": {
                "value": false,
                "type": "boolean"
            },
            "Quiet": {
                "value": false,
                "type": "boolean"
            }
        }
    }
}

```

but without starting a search. The iframe seems to just reload the document. Some other uno commands like highlighting (after manually selecting text) work in edit mode tough.

Any idea if that’s just a mistake on my side?

Best wishes

---

<div class="post-metadata">

**Author:** ![darshan](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.collaboraonline.com/darshan/32/2230_2.png) [@darshan](https://forum.collaboraonline.com/u/darshan)\
**Post date:** [July 7, 2025, 2:35pm UTC](https://forum.collaboraonline.com/t/highlight-text-snippets-in-wopi-application-ideally-in-view-mode/3840/4 "2025-07-07T14:35:33Z")

</div>

> [@darshan](#):
>
> No, directly highlighting text snippets in Collabora WOPI view mode using PostMessages and UNO commands for persistent, document-embedded highlights is generally not possible. View mode prevents document modifications. You would likely need to explore external UI overlays, which are complex, or temporarily switch to edit mode if acceptable

@pakue I believe I’ve already pointed out that the scenario you’re referring to directly highlighting text snippets in WOPI view mode using PostMessages and UNO commands is most likely **not possible**. The command I suggested earlier was just a potential idea, but it may not work reliably in read-only mode.

Please feel free to explore other UNO commands if you’re looking for alternatives, but I don’t have any further input to add on this for now.

Thanks,  
Darshan

---

<div class="post-metadata">

**Author:** ![darshan](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.collaboraonline.com/darshan/32/2230_2.png) [@darshan](https://forum.collaboraonline.com/u/darshan)\
**Post date:** [July 10, 2025, 6:10am UTC](https://forum.collaboraonline.com/t/highlight-text-snippets-in-wopi-application-ideally-in-view-mode/3840/5 "2025-07-10T06:10:37Z")

</div>

Closed on July 10, 2025, 6:10am UTC


