Comments (11)
I can't reproduce.
---
date: "`r Sys.Date()`"
author: "Your Name"
title: "Untitled"
output:
officedown::rpptx_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE, fig.cap = TRUE)
library(officedown)
library(ggplot2)
library(rvg)
```
## Table
```{r layout='Two Content', ph=officer::ph_location_left()}
head(cars)
```
```{r layout='Two Content', ph=officer::ph_location_right()}
head(iris)
```
Can you describe your issue so that we can help? Please provide a reproducible example, also provide your sessionInfo()
results after loading officedown
from officedown.
Dear @davidgohel,
thank you for the code snippet and the screenshot.
That is exactly as it looks like on my machine.
However, the "two column" layout is artificial, since the real layout behind that slide is still "Title and Content".
I the meantime I tried this code snippet
`## Two Columns Slide
:::::: {.columns}
::: {.column width="50%"}
Content of the left column.
here should be a table, but it is not
Spalte 1 | Spalte 2 |
---|---|
A | 10 |
B | 20 |
:::
::: {.column width="90%"}
Content of the right column.
Column width is ignored
:::
::::::
`
This new slide uses the "right" layout.
However in pptx there is no table shown at all.
Even inserting r-chunks is in vain (e.g. via flextbale)
What I intend to get from rmarkdown in pptx is the ability to write text as a table and change the column widths.
But so far I did not find a solution for that. (your flextable-package does include a working width-argument for provided dataframes but the tables do not follow the intended style guide).
Can you change the default layout in the YAML?
Cheers
from officedown.
Dear @davidgohel,
IMHO the best to get would be implementing the idea from rdocx also in rpptx:
## Word-like columns notation for PowerPoint
The following will be in a separated section with 2 columns:
<!---BLOCK_MULTICOL_START--->
Blah blah blah on column 1.
<!---CHUNK_COLUMNBREAK--->
Blah blah blah on column 2.
<!---BLOCK_MULTICOL_STOP{widths: [1,3], space: 0.2, sep: true}--->
Here the columns can be designed.
However, I'm pretty sure that powerpoint behaves completely different than word...
from officedown.
That is exactly as it looks like on my machine.
However, the "two column" layout is artificial, since the real layout behind that slide is still "Title and Content".
I don't understand what is your issue. This is an R Markdown extension, it uses pandoc. That's what pandoc is generating. Using layout='Two Content', ph=officer::ph_location_left()
in chunk options is like "use properties defined in left placeholder of the layout two content".
I the meantime I tried this code snippet
Same with default R Markdown powerpoint_presentation
, you can't mix different types in PowerPoint.
What I intend to get from rmarkdown in pptx is the ability to write text as a table and change the column widths.
I am not sure it helps, but you could try with ph_location
to control the exact size.
the intended style guide
The default values can be changed, see help pages here: https://davidgohel.github.io/flextable/articles/format.html
Can you change the default layout in the YAML?
No
IMHO the best to get would be implementing the idea from rdocx also in rpptx:
No, it does not behave the same
from officedown.
@davidgohel
I see, the "layout" argument is used to mirror the characteristics of certain placeholders.
Please check and update your documentation
https://davidgohel.github.io/officedown/reference/rpptx_document.html
I assumed this would be possible:
---
date: "`r Sys.Date()`"
author: "Your Name"
title: "Untitled"
output:
officedown::rpptx_document:
layout: "Two Content"
---
I'm gonna try the ph_location.
Thanks for the fast response and discussion.
from officedown.
Sorry, I understood you wanted to change the default value of the layout in the current implementation. Then, as stated in the documentation, you can use layout
to use another default value for layout (that will be used to get placeholder settings).
from officedown.
@davidgohel Update:
In order to position r-chunk tables according to predefined pptx-placeholders I created a "just for pandoc"-slide called "Textchart_2h_B'". This works for simple tables like "head(iris)". However, up until now I did not figure out, how to position a flextable.
This has no effect on the flextable. Perhaps there is a solution with ph_with inside the chunk? But what to do with the "x" argument, since we are inside/generating an rpptx object.
ft1 <- flextable(head(iris))
arrW <- dim_pretty(ft1)
ft1 <- width(ft1, width = arrW$widths)
ft1
# has not effect
Btw, the layout-YAML-Parameter has no effect at all. Perhaps you could provide a screenshot of the pptx-file with layout "Two Conten" inside the YAML.
Cheers
from officedown.
Is that not a new issue(s)?
If yes, could you open a new issue, one for each case, provide a reproducible example, provide the results of sessionInfo()
from officedown.
from officedown.
@davidgohel Thank you very much.
In terms of ph_location_left
I just noticed that this special function always uses the existing layout in 'Two Content', which cannot be overwritten.
For my flextable-issue I open a new issue.
Cheers
from officedown.
II assume you did not read the documentation of ph_location_left
. It says:
The function will return the location corresponding to a right bounding box. The function assume the layout 'Two Content' is existing.
If you don't have that layout, use ph_location_type
or another one. I have just completed the documentation by adding
This is an helper function, if you don't have a layout named 'Two Content', use [ph_location_type()] and set arguments to your specific needs.
from officedown.
Related Issues (20)
- Math font in rdocx_document HOT 1
- Add image to word doc header without using reference docx
- Error when using `knit_print_block` in loop HOT 6
- Header Problems concomitant with page numbering HOT 6
- Support {.unlisted .unnumbered} to exclude headings from table of contents HOT 2
- table caption style in yaml not used HOT 4
- insert section with page_margins, header and footer
- Help with using flextable in officedown HOT 10
- Import the figure as its original height/width ratio HOT 14
- (How to) Add footnotes through officedown HOT 1
- Fields Word document HOT 1
- Name for `tab.id` must not contain `_`? HOT 1
- `rpptx_document` does not use the assigned layout in code chunk HOT 3
- accessing different parts of word doc HOT 3
- how to add page numbers, title page and sections in word using officedown HOT 1
- Extra section break is created after MULTCOLUM stop HOT 5
- Option to output Word doc with line numbering HOT 5
- dml bg is always "white" in R Markdown HOT 2
- `block_pour_docx` but only for part of file to be poured
- Images in page headers of reference docx misplaced when using <!---BLOCK_LANDSCAPE_START---> <!---BLOCK_LANDSCAPE_STOP---> HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from officedown.