We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Hyperlinks issue with absolute path

Hello,



I encounter some hyperlink errors when I update fields in a .doc file.



First, I create my Document object (docDataDir and docName are arguments) :



// Create the output document.

Document doc2 = new Document(docDataDir + “/” + docName);



doc2.getMailMergeSettings().setViewMergedData(true);

doc2.getMailMergeSettings().setDoNotSupressBlankLines(true);

doc2.getMailMergeSettings().setLinkToQuery(true);







Then I update the properties :



CustomDocumentProperties props = doc2.getCustomDocumentProperties();

for (int temp = 0; temp



// Update Properties

if (props.get(fieldNames[temp]) != null)

{

doc2.getCustomDocumentProperties().remove(fieldNames[temp]);

props.add(fieldNames[temp], fieldPropValues[temp]);

} else {

props.add(fieldNames[temp], fieldPropValues[temp]);

}



}



// Update Fields

doc2.updateFields();





And finally, I save the output Document:



// Save the output document.

doc2.save(docDataDir + “/”+ docName + “.Out.doc”);







When I execute this program, all fields are updated as I want. But some hyperlink are modified too.



For example,



Example 1:



if the initial .doc file contains an hyperlink named “P:\ENGINEERING\SIMU_A350_VIP\REFERENCE\20 - UM\Quick Start”

which redirect to

“\sfs.corp\Projects\ENGINEERING\SIMU_A350_VIP\REFERENCE\20 - UM\Quick Start”



at the end of treatment, in the output .doc file,

the same hyperlink redirect to



“P:\ENGINEERING\SIMU_A350_VIP\REFERENCE\20 - UM\Quick Start”



KO



Example 2 :

if the initial .doc file contains an hyperlink named “Quick Start”

which redirect to

“\sfs.corp\Projects\ENGINEERING\SIMU_A350_VIP\REFERENCE\20 - UM\Quick Start”



at the end of treatment, in the output .doc file,

the same hyperlink redirect to



“\sfs.corp\Projects\ENGINEERING\SIMU_A350_VIP\REFERENCE\20 - UM\Quick Start”



OK



So, it seems that the display of the hyperlink impacts the redirection when it contains an absolute path (P:…)





Can you please help me to solve this problem ?



I used aspose.words (16.3)



Thanks for any help in advance.



Regards,



Simon

Hi Simon,

Thanks for your inquiry. To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input Word document
  • Please attach the output Word file that shows the undesired behavior.
  • Please create a standalone Java application (source code without compilation errors) that helps us to reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we'll start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip them and Click 'Reply' button that will bring you to the 'reply page' and there at the bottom you can include any attachments with that post by clicking the 'Add/Update' button.