PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Thu Mar 28, 2024 6:44 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Sun Nov 14, 2021 9:00 pm 
Offline

Joined: Sun Nov 03, 2019 7:51 pm
Posts: 47
Hi

Can somebody give me a small code example on how to insert Hyperlink into table cell?

I tried this, but only the text "test" appears but no link appearing in the table cell "Cells[1]".

Code:
var linkParagraph = newRow.Cells[1].AddParagraph("test");
var hyperlink = linkParagraph.AddHyperlink("http://stackoverflow.com/", HyperlinkType.Url);


Jessica


Top
 Profile  
Reply with quote  
PostPosted: Mon Nov 15, 2021 8:02 am 
Offline
PDFsharp Expert
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 909
Location: CCAA
Hi!

You do not add any text to the hyperlink, so the link has no visible text and nothing to click on.

Code:
Paragraph para = section.AddParagraph();
var link = para.AddHyperlink(@"http://www.google.com/", HyperlinkType.Web);
link.AddText("Click here");

_________________
Best regards
Thomas
(Freelance Software Developer with several years of MigraDoc/PDFsharp experience)


Top
 Profile  
Reply with quote  
PostPosted: Sat Nov 20, 2021 10:01 pm 
Offline

Joined: Sun Nov 03, 2019 7:51 pm
Posts: 47
Hi

How can I make the paragraph text ITSELF to become the link text?


Top
 Profile  
Reply with quote  
PostPosted: Mon Nov 22, 2021 8:40 am 
Offline
PDFsharp Expert
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 909
Location: CCAA
Jessica wrote:
How can I make the paragraph text ITSELF to become the link text?
Make the Hyperlink the only content of the paragraph and add all text to the Hyperlink.

_________________
Best regards
Thomas
(Freelance Software Developer with several years of MigraDoc/PDFsharp experience)


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: Bing [Bot] and 137 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group