[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [libreoffice-users] Bug selecting text using the API
- Subject: Re: [libreoffice-users] Bug selecting text using the API
- From: "Mauricio Baeza" <email@example.com>
- Date: Sun, 20 Oct 2019 21:22:27 -0500 (CDT)
- To: "users" <firstname.lastname@example.org>
On Sun, 20 Oct 2019 21:07:26 -0400, Andrew Douglas Pitonyak <email@example.com> wrote:
> Tested using LO 220.127.116.11 on Fedora Linux.
> I wanted to find all instances of Italic text using the API and select
> that text. I created a simple document with four areas that were Italic.
> I used the following macro and, although FindAll does return all italic
> text, it only selects the last three instances and not the first one.
> My example had two instances in normal text and two instances in a text
> If I have more than once instance, it ignores the first. If I have ONLY
> one instance of Italic text, it will select the text.
> Sub FindItalic_all
> Dim oDescriptor 'The search descriptor
> Dim oFound 'The found range
> Dim SrchAttributes(0) as new com.sun.star.beans.PropertyValue
> SrchAttributes(0).Name = "CharPosture"
> SrchAttributes(0).Value = com.sun.star.awt.FontSlant.ITALIC
> ' SrchAttributes(0).Name = "CharFontName"
> ' SrchAttributes(0).Value = "Comic Sans MS"
> oDescriptor = ThisComponent.createSearchDescriptor()
> oFound = ThisComponent.findAll(oDescriptor)
> ' Dim i As Integer
> ' for i = 0 To oFound.Count - 1
> ' Print oFound.getByIndex(i).getString(i)
> ' Next
> End Sub
Can you share your document?
To unsubscribe e-mail to: firstname.lastname@example.org
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.libreoffice.org/global/users/
|[libreoffice-users] Bug selecting text using the API||Andrew Douglas Pitonyak <email@example.com>|
- Prev by Date: [libreoffice-users] Bug selecting text using the API
- Next by Date: Re: [libreoffice-users] Bug selecting text using the API
- Previous by thread: [libreoffice-users] Bug selecting text using the API
- Next by thread: Re: [libreoffice-users] Bug selecting text using the API