Git Product home page Git Product logo

Comments (11)

davidgohel avatar davidgohel commented on June 16, 2024

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)
```


Capture d’écran 2020-07-06 à 15 07 19

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.

Pindar777 avatar Pindar777 commented on June 16, 2024

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.

Pindar777 avatar Pindar777 commented on June 16, 2024

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.

davidgohel avatar davidgohel commented on June 16, 2024

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.

Pindar777 avatar Pindar777 commented on June 16, 2024

@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.

davidgohel avatar davidgohel commented on June 16, 2024

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.

Pindar777 avatar Pindar777 commented on June 16, 2024

@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.

davidgohel avatar davidgohel commented on June 16, 2024

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.

davidgohel avatar davidgohel commented on June 16, 2024

Capture d’écran 2020-07-08 à 12 31 16

from officedown.

Pindar777 avatar Pindar777 commented on June 16, 2024

@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.

davidgohel avatar davidgohel commented on June 16, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.