cancel
Showing results for 
Search instead for 
Did you mean: 

Open a document when URL is clicked

Former Member
0 Kudos

I have a .html file in MIMES and using this code. but its not working. Any help??

if possible give me the steps to do this. Thanks!

WDURLGenerator.getWebResourceURL(wdComponentAPI.getDeployableObjectPart(),

"my-file.html")

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Pankaj,

Try using the absolute url for your html file.

Use folliwing function :

<b>WDURLGenerator.getAbsoluteWebResourceURL(deployableObjectPart, resourceName)</b> - returns the URL for the reource say my_file.html in your case.

You can then fire an exit plud for the url you get in the above step or use this url as source to 'Frame' control.

Hope this solves your problem.

Former Member
0 Kudos

Thanks.. its working but the problem is the text on the link is coming as the view.viewname.linkname.... can I set it to any test .. for ex .." testlink"?

Former Member
0 Kudos

Can you describe exactly what you have implemented? Maybe you are using a locale for which the link text is not available and the resource key is displayed instead of the value.

Armin

Former Member
0 Kudos

1. created Ui element - link to url.

2. created a context attribute and mapped to the above element.

3. used the code in oninit. (code given in my prev post )

4. stored the .html file in Mimes.

Hope this helps. Thanks!

Former Member
0 Kudos

Hi..can you please help me with my above reply. Thanks!

Former Member
0 Kudos

I just tested this with a >NW04s runtime and the following code for opening a pdf file:

  public void wdDoInit()
  {
    //@@begin wdDoInit()
    String url = WDURLGenerator.getWebResourceUrl(wdComponentAPI.getDeployableObjectPart(), "patterns.pdf");
    wdContext.currentContextElement().setDocumentUrl(url);
    //@@end
  }

Did you assign a value to the "text" property of the LinkToURL? Whcih locale are you using at runtime?

Armin

Former Member
0 Kudos

Thanks a lot!!! it works now...text field was not filled properly.

Answers (1)

Answers (1)

Former Member
0 Kudos

Your code looks OK. BTW, are you using LinkToURL UI element? If yes, then simply set the reference property of it to the Url that you are generating.

Bala