Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fortify_location.location_label more than a row have been selected #363

Closed
john-harrold opened this issue Apr 18, 2021 · 3 comments
Closed

Comments

@john-harrold
Copy link
Contributor

I am trying to help a friend customize a corporate PowerPoint template to use with officer. When I use annotate_base:

library(officer)
annotate_base(path        = "broken_example.pptx")

I will email the broken_example.pptx file separately. I get the following error and traceback()

Error: `x` must be a string of length 1
In addition: Warning message:
In fortify_location.location_label(location, doc = x) :
  more than a row have been selected
> traceback()
10: stop("`x` must be a string of length 1", call. = FALSE)
9: as_xml_document.character(xml_elt)
8: as_xml_document(xml_elt)
7: ph_with.character(x = ppt, value = textstr, location = ph_location_label(type = lp$type[pidx], 
       ph_label = lp$ph_label[pidx]))
6: ph_with(x = ppt, value = textstr, location = ph_location_label(type = lp$type[pidx], 
       ph_label = lp$ph_label[pidx]))
5: annotate_base(path = "broken_example.pptx") at reprex.R#3
4: eval(ei, envir)
3: eval(ei, envir)
2: withVisible(eval(ei, envir))
1: source("reprex.R")

Output from sessionInfo()

R version 3.6.3 (2020-02-29)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Catalina 10.15.6

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] officer_0.3.18

loaded via a namespace (and not attached):
[1] compiler_3.6.3 R6_2.5.0       tools_3.6.3    uuid_0.1-4     xml2_1.3.2    
[6] zip_2.1.1 
@davidgohel
Copy link
Owner

Hi @john-harrold

This is because you have a duplicated label in one placeholder. I have just updated the package so that you get an error and a clear message about which label is duplicated. When annotate_base is now using fortify_location.location_label() and it wants unique labels to be sure it writes in the correct placeholder.

Let me know if helps

@john-harrold
Copy link
Contributor Author

I thought it was something like that. Whenever I duplicated one of those elements in the slide master it wasn't assigning it a new place holder. I've never experienced that before. Thanks.

@github-actions
Copy link

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants