boxable icon indicating copy to clipboard operation
boxable copied to clipboard

Hyperlink inside Cell

Open mubinayubkhan opened this issue 8 years ago • 8 comments

Hi All,

I have been trying to find a way I could insert a hyperlink inside a table cell. Unfortunately since row.createCell only takes float and String parameters, not really sure how to insert a hyperlink in it.

I've tried using <a href tag as well but seems like that is not supported as well. Is there a way to get this working? Any help will be highly appreciated.

Thank you

mubinayubkhan avatar Sep 07 '17 09:09 mubinayubkhan

I am pretty sure that Adobe will make any http:// or https:// as hyperlink. Try with that

Frulenzo avatar Sep 07 '17 12:09 Frulenzo

Unfortunately, when I put in < a href='www.google.com' >Link< /a > I get this printed as it is the cell. This is what I've written,

Row<PDPage> attachmentsRow = table.createRow(rowHeight); cell = attachmentsRow.createCell(30, "Attachments"); cell = attachmentsRow.createCell(70, "< a href='www.google.com' >Test"); cell.setFillColor(descriptionCell); cell.setFont(PDType1Font.HELVETICA_BOLD);

The result is,

| Attachments | < a href='www.google.com' >Test |

rather than,

| Attachments | Test |

P.S> Please note spaces in html code above is added to display it as string otherwise they were being converted to hyperlinks

mubinayubkhan avatar Sep 07 '17 14:09 mubinayubkhan

What happen when you just say: https://google.com ? Did you tried that?

Frulenzo avatar Sep 07 '17 15:09 Frulenzo

@Frulenzo Do you mean without the <a href tag or with? I am just trying it ... will update you in 5 mins

mubinayubkhan avatar Sep 07 '17 15:09 mubinayubkhan

@Frulenzo Okay I tried using the <a href tag and even without, it displays https://google.com, the cursor even changes to click one but clicking on it doesn't work.

mubinayubkhan avatar Sep 07 '17 15:09 mubinayubkhan

Yeah, I see --> feature request

Frulenzo avatar Nov 06 '17 13:11 Frulenzo

any update on this?

aashirwadgupta avatar Oct 25 '19 10:10 aashirwadgupta

Hi, I just added a pull request with some code that will allow you to set a Cell's URL, based on code developed for my employer. Please let me know if any refinements are required to make it suitable for merge.

lambart avatar Jul 22 '21 17:07 lambart