1
library(officer)
library(flextable)
library(tidyverse)

x <- read_pptx()

data_flex <- flextable(iris)

y <- add_slide(x, layout='Title Slide') %>%
  ph_with(value=data_flex, 
          location=ph_location(left=0.5, top=0.5),
          alt_text = 'alt text test')

print(y, target='iris.pptx')

I've created automated powerpoint reports for work, and am now being required to add alt-text to charts and tables for ADA accessibility. The officer documentation shows an alt_text argument, but I haven't been able to get it to work. I've tried it as text, c(), and list(), but nothing seems to work. Are there any examples of how to use this argument?

Josh
  • 33
  • 4
  • 2
    Hi Josh, please provide a [minimal reproducible example](https://stackoverflow.com/q/5963269/17303805), including the code you’ve tried and data needed to run the code — either your actual data or made-up example data. – zephryl Dec 21 '22 at 02:40
  • 1
    In the example above, the powerpoint file is created with the flextable of iris dataset. The alt-text field under Format Shape is blank instead of having the value "alt text test" – Josh Dec 27 '22 at 23:04
  • In my version of officer (0.4.0), the 'alt text' parameter is only listed for ggplot2 objects, and the underlying code for external image objects doesn't make use of it. Will require the package creator to confirm this, but it could be an outdated feature that's no longer maintained / available? – Z.Lin Mar 13 '23 at 09:45

0 Answers0