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

DSL #59

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open

DSL #59

wants to merge 17 commits into from

Conversation

kobsy
Copy link
Member

@kobsy kobsy commented Jan 26, 2016

Enables jQuery-style method chaining, as well as element/property initialization with blocks:

document.styles << OpenXml::Docx::Style.new(:paragraph)
  .id("ParaStyle1")
  .paragraph
    .alignment(:center)
    .end_chain
  .character
    .bold(true)
    .end_chain
...
paragraph = OpenXml::Docx::Elements::Paragraph.new
  .paragraph_style("ParaStyle1")
paragraph << OpenXml::Docx::Elements::Run.new("Text for a default text element") do
  push OpenXml::Docx::Elements::Break.new
end

@kobsy kobsy added the wip label Jan 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants