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

Free Support Forum - aspose.com

Add Hyperlink via LINQ Reporting Engine of Aspose.Words

Hi, i have the same question is it posible to be allowed to se the solution?

@tinaInge,

Please see these documents Docs.zip (19.1 KB) and try running the following code:

Document doc = new Document("D:\\Temp\\template.docx");

Sender sender = new Sender { Name = "LINQ Reporting Engine", Message = "Hello World", Hyperlink1 = @"http://Aspose.com" };
ReportingEngine engine = new ReportingEngine();
engine.BuildReport(doc, sender, "s");

doc.Save("D:\\temp\\18.9.docx");
////////////////////////
public class Sender
{
    public string Name;
    public string Message;
    public string Hyperlink1;
}

Hope, this helps.

@tinaInge,

Another easier way that you can use to insert Hyperlinks in Word document dynamically is to use the new link tag in template. Please refer to the following section of documentation for details:
Inserting Hyperlinks Dynamically

Please see these input/output documents link.zip (17.6 KB) and try running the following code:

Document doc = new Document("D:\\Temp\\template.docx");

Sender sender = new Sender { display_text_expression = "Display Text", uri_expression = @"https://www.aspose.com/" };
ReportingEngine engine = new ReportingEngine();
engine.BuildReport(doc, sender, "s");

doc.Save("D:\\temp\\18.9.docx");

@awais.hafeez,
Thanks, for the exsamples the link tag works fine for www. links, when i save the mereged template as .pdf. But i need to make links to files (pdf, doc, docx, txt etc) wich will be placed in an attachement folder in next to the mereged pdf. When i use the link tag i i get a link in the merged pdf that looks like “file:///C|/temp/Attachement/bilag1.docx” where the right path should have been “C:/temp/Attachement/bilag1.docx”.

my tag looks like this: <<link [FilePath] [FileName]>>
my data is: FilePath = “Attachements//bilag1.docx” and FFileName = “bilag1.docx”

How doo i build a tag that can link to a file?

no worries i have figured i out the // should be \ the link still looks a bid funny but the file openes.

@tinaInge,

Good to know that you have sorted it out. Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.