Free Ruby Library for Working with Microsoft® PowerPoint Files
Open Source Ruby API to to Create, Edit, View & Convert Microsoft PowerPoint PPT and PPTX Presentations
What is PowerPoint Library?
PowerPoint presentations play a vital role in both business and education, allowing professionals to share ideas in a dynamic, visual format. However, building high-quality slides from scratch can be time-consuming and demands solid design skills. The PowerPoint Ruby gem simplifies this process by enabling software developers to create, read, edit, and manipulate PowerPoint presentations programmatically with minimal code. It helps automate slide creation, making it easier for developers to generate visually appealing presentations without manual effort.
The PowerPoint Ruby gem is a powerful and easy-to-use Ruby library based on the Microsoft Office Open XML format. It allows you to create PowerPoint presentations from databases, spreadsheets, or user input, offering full control over slide design. Software developers can customize layouts, insert new slides, manage color schemes, and add multimedia elements like images, videos, and audio. You can also tailor fonts and text styles for a polished look. As an open source and free tool, this gem is ideal for developers seeking to automate or streamline their PowerPoint presentation workflow using Ruby.
Getting Started with 'powerpoint'
The recommend way to install PowerPoint Ruby library is using Ruby gem. Please use the following command for a smooth installation.
Install 'powerpoint' via Ruby gem
gem install powerpoint
You can also download it directly from GitHub repository.Create PowerPoint Presentation via Ruby API
PowerPoint Ruby gem has included complete functionality for creating and editing Microsoft PowerPoint presentations inside Ruby applications. There are several important features part of the library that helps software developers to handle their presentations, such as adding table slides to presentation, specifying layout and title of the slide, inserting images to slides, adding text to the slides, deleting unwanted slides, applying styles and formatting and many more. The following example demonstrates how to create a PowerPoint presentation with basic data using Ruby commands.
How to Create PowerPoint Presentation via Ruby API?
require 'powerpoint'
ppt = Powerpoint::Presentation.new
title_slide = ppt.add_slide(Powerpoint::TitleSlideLayout.new, 'Title')
content_slide = ppt.add_slide(Powerpoint::ContentSlideLayout.new, 'Content')
title_slide.add_title('My Presentation')
content_slide.add_text('This is the content of my presentation.')
ppt.save('my_presentation.pptx')
Add and Manage Presentation’s Slides via Ruby API
The open source Ruby library ‘PowerPoint’ gives software developers complete control over adding and customizing slides inside their own Ruby applications. The library has included several important features for working with presentation’s slides, such as insert new slides to existing presentations, add image slide with text content, delete unwanted slides from the presentations, get the number of slides in the presentation, get a specific slide from a presentation, and many more. The following example demonstrates how to add a new slide to presentation and inserting an image to the slide using Ruby commands.
How to Add New Slides to Presentations inside Ruby Apps?
require 'powerpoint'
presentation = Powerpoint::Presentation.new
# add a new slide to the presentation
slide = presentation.add_slide(Powerpoint::SlideLayout::TITLE_AND_CONTENT)
textbox = slide.add_textbox(left: 100, top: 100, width: 400, height: 200)
textbox.text = "Hello, World!"
# add an image to a slide,
slide.add_picture("image.jpg", left: 100, top: 100, width: 400, height: 200)
# Save Presentation
presentation.save("my_presentation.pptx")
presentation = Powerpoint::Presentation.open("my_presentation.pptx")