Hi Support,
what is the easiest way to get the selected text in a document.
I'm sure it is posted somwhere here but I can't find it.
I don't need e_docSelection_changed...
Get selected text
Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan
Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.
When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.
When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
-
- Site Admin
- Posts: 17960
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
Re: Get selected text
Hello khho,
You will probably need the methods of this interface:
https://sdkhelp.pdf-xchange.com/vi ... tSelection
Kind regards,
Stefan
You will probably need the methods of this interface:
https://sdkhelp.pdf-xchange.com/vi ... tSelection
Kind regards,
Stefan
-
- User
- Posts: 34
- Joined: Fri Mar 11, 2022 11:02 am
Re: Get selected text
I do it like this:
What is the best way to determine nPageIndex for GetSel?
Code: Select all
PDFXEdit.IPXV_DocSelection docSel = doc.ActiveSel;
if (docSel is PDFXEdit.IPXV_TextSelection)
{
PDFXEdit.IPXV_PageTextSelection pageSel = ((PDFXEdit.IPXV_TextSelection)docSel).GetSel(0,true);
result = pageSel.GetPlainText();
}
-
- Site Admin
- Posts: 2353
- Joined: Thu Jun 30, 2005 4:11 pm
- Location: Canada
Re: Get selected text
Hope this will help:
Cheers.
Code: Select all
int selID = pxvInst.Str2ID("selection.text");
PDFXEdit.IPXV_DocSelection docSel = doc.GetSel(selID);
if (docSel != null)
{
PDFXEdit.IPXV_TextSelection textSel = (PDFXEdit.IPXV_TextSelection)docSel;
uint countOfPagesWithSelText = textSel.Count;
for (unit i = 0; i < countOfPagesWithSelText; i++)
{
PDFXEdit.IPXV_PageTextSelection pageTextSel = textSel[i];
unit pageIndex = pageTextSel.PageIndex;
...
...
}
}
Vasyl Yaremyn
Tracker Software Products
Project Developer
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
Tracker Software Products
Project Developer
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
-
- User
- Posts: 34
- Joined: Fri Mar 11, 2022 11:02 am
Re: Get selected text
Yes, that helped (again)!
With this example I don't need the PageIndex anymore.
Thanks!
With this example I don't need the PageIndex anymore.
Thanks!
-
- Site Admin
- Posts: 17960
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London