Copy link to clipboard
Copied
How do I check the paragraph has hyperlink destination
Hi priyak7746321​,
I digged a bit got this, you may give it a shot:
...var myDoc = app.documents[0];
for(var pg = 0; pg < myDoc.pages.length; pg++){
for(var tf = 0; tf < myDoc.pages[pg].textFrames.length; tf++){
for(var p = 0; p < myDoc.pages[pg].textFrames[tf].paragraphs.length; p++){
if(checkIfDestinationHyerlink(myDoc, myDoc.pages[pg].textFrames[tf].paragraphs
)){
//Use it as per your need
$.writeln("Destination hyperlink found in this para----");
Copy link to clipboard
Copied
I am going to add hyperlink for text. if the text has existing hyperlink destination how to validate. anyone please advice.
Copy link to clipboard
Copied
Hi priyak7746321​,
I digged a bit got this, you may give it a shot:
var myDoc = app.documents[0];
for(var pg = 0; pg < myDoc.pages.length; pg++){
for(var tf = 0; tf < myDoc.pages[pg].textFrames.length; tf++){
for(var p = 0; p < myDoc.pages[pg].textFrames[tf].paragraphs.length; p++){
if(checkIfDestinationHyerlink(myDoc, myDoc.pages[pg].textFrames[tf].paragraphs
)){
//Use it as per your need
$.writeln("Destination hyperlink found in this para----");
}
else{
$.writeln("No Destination hyperlink !");
}
}
}
}
//
function checkIfDestinationHyerlink(myDoc, myPara){
for(var hd = 0; hd < myDoc.hyperlinkTextDestinations.length; hd++){
if(myDoc.hyperlinkTextDestinations[hd].destinationText.paragraphs[0] == myPara){
return true
}
}
return false;
}
Best
Sunil