Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

👮 officer: office documents from R

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md
NotificationsYou must be signed in to change notification settings

davidgohel/officer

Repository files navigation

Make corporate reporting with minimum hassle

R build statusversioncodecov test coverage

The officer package lets R users manipulate Word (.docx) andPowerPoint (*.pptx) documents. In short, one can add images, tablesand text into documents from R. An initial document can be provided;contents, styles and properties of the original document will then beavailable. It also supports the writing of ‘RTF’ documents.

Ressources

The help pages are in a bookdown located at:

https://ardata-fr.github.io/officeverse/

Manuals are available at:

https://davidgohel.github.io/officer/.

Word documents

Theread_docx() function will read an initial Word document (an emptyone by default) and lets you modify its content later.

The package provides functions to add R outputs into a Word document:

  • images: produce your plot in png or emf files and add them into thedocument, as a whole paragraph or inside a paragraph.
  • tables: add data.frames as tables, format is defined by the associatedWord table style.
  • text: add text as paragraphs or inside an existing paragraph, formatis defined by the associated Word paragraph and text styles.
  • field codes: add Word field codes inside paragraphs. Field codes is anold feature of MS Word to create calculated elements such as tables ofcontents, automatic numbering and hyperlinks.

File generation is performed with theprint function.

import Word document in a data.frame

The functiondocx_summary() reads and imports content of a Worddocument into a data.frame. The function handles paragraphs, tables andsection breaks. The functiondocx_comments() reads comments of a Worddocument and organise the results into a data.frame.

PowerPoint documents

The functionread_pptx() will read an initial PowerPoint document (anempty one by default) and let you modify its content later.

The package provides functions to add R outputs into existing or newPowerPoint slides:

  • images: produce your plot in png or emf files and add them in a slide.
  • tables: add data.frames as tables, format is defined by the associatedPowerPoint table style.
  • text: add text as paragraphs or inside an existing paragraph, formatis defined in the corresponding layout of the slide.

In a PowerPoint document, one can set a slide as selected and reach aparticular shape (and remove it or add text).

File generation is performed with theprint() function.

import PowerPoint document in a data.frame

Thepptx_summary() function reads and imports content of a PowerPointdocument into a data.frame. The function handles paragraphs, tables andimages.

Extensions

Tables and packageflextable

The packageflextablebrings a full API to produce nice tables and use them with packagesofficer and rmarkdown.

Vector graphics with packagervg

The packagervg brings an API toproduce nice vector graphics that can be embedded in PowerPointdocuments or Excel workbooks withofficer.

Native office charts with packagemschart

The packagemschart combinedwithofficer can produce native office charts in PowerPoint and Worddocuments.

Advance Word documents with R Markdown with packageofficedown

The packageofficedownfacilitates the formatting of Microsoft Word documents produced by RMarkdown documents.

Installation

You can get the development version from GitHub:

devtools::install_github("davidgohel/officer")

Or the latest version on CRAN:

install.packages("officer")

Getting help

If you have questions about how to use the package,visit StackOverflow’sofficertag and post yourquestion there. I usually read them and answer when possible.

Contributing to the package

Code of Conduct

Anyone getting involved in this package agrees to ourCode ofConduct.

Bug reports

When you file abugreport,please spend some time making it easy for me to follow and reproduce.The more time you spend on making the bug report coherent, the more timeI can dedicate to investigate the bug as opposed to the bug report.

Contributing to the package development

A great way to start is to contribute an example or improve thedocumentation.

If you want to submit a Pull Request to integrate functions of yours,please provide:

  • the new function(s) with code and roxygen tags (with examples)
  • a new section in the appropriate vignette that describes how to usethe new function
  • add corresponding tests in directorytests/testthat.

By using rhub (runrhub::check_for_cran()), you will see if everythingis ok. When submitted, the PR will be evaluated automatically on travisand appveyor and you will be able to see if something broke.


[8]ページ先頭

©2009-2025 Movatter.jp