0

I'm using flextable and officer to write a table with hyperlinked cells to a powerpoint slide, but I can't figure out how to remove the underline in the URL. Here's my code:

library(officer)
library(flextable)
library(magrittr)

# Make the table
no_ul <- fp_text(underlined = FALSE)
ft <- data.frame(x = "Hello", link = "www.google.com") %>%
  flextable(col_keys = "x") %>%
  compose(j = 1, 
          value = as_paragraph(hyperlink_text(x = x, url = link, props = no_ul))
  )
    
# Add to a slide
my_pres <- read_pptx() %>%
  add_slide() %>%
  ph_with(value = ft, location = ph_location_type(type = "body"))

print(my_pres, "~/Desktop/flex_example.pptx")

When I open up "flex_example.pptx" this is the table:

enter image description here

How do I remove the underline of the hyperlink???? I was hoping underlined = FALSE would do it, but no luck!

THANK YOU IN ADVANCE!!!!

redarah
  • 152
  • 7
  • Can you do it in PowerPoint? No! So you can't do it in code either. – John Korchok Mar 15 '21 at 23:08
  • interestingly enough you can do it in Google Slides, but not Powerpoint. So when I upload the .pptx to google slides I can un-underline from there - which gave me hope that there was something I could hack here? – redarah Mar 16 '21 at 09:49
  • You can change the hyperlink color in the theme: https://support.microsoft.com/en-us/office/change-the-color-of-hyperlink-text-throughout-a-presentation-77c55b2d-3b2e-4ec4-924c-3165972e1bfa#OfficeVersion=macOS. I don't know if you can remove the underline – David Gohel Mar 16 '21 at 10:38
  • Bummer! It looks like one way to hack it in powerpoint is to go `Format > Font > Underline style` (select single line) `> Underline color` (select white). Because then it overlays a white underline on top, which makes it look like there's no more URL underline (hacky? but works?). But I can't figure out how to code this up - is there a way to make the color of the underline different from the text in `flextable`? – redarah Mar 16 '21 at 12:03

0 Answers0