diff --git a/LICENSE b/LICENSE index 2ebc1eaf5..42b346bce 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2016 Brent Ely +Copyright (c) 2015-2016 Brent Ely Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 431d13d3f..bc1a6a0e5 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,8 @@ By including the PptxGenJS framework inside an HTML page, you have the ability t * The presentation export is pushed to client browsers as a regular file without any interaction required * Complete HTML5/JavaScript solution - no other libraries, plug-ins, or settings are required +Additionally, this framework includes a unique Table-To-Slides feature that will reproduce an HTML Table in 1 or more slides with a single command. + Supported write/output formats: * PowerPoint 2007+ and Open Office XML format (.PPTX) @@ -13,54 +15,96 @@ Supported write/output formats: [http://gitbrent.github.io/PptxGenJS](http://gitbrent.github.io/PptxGenJS) # Installation -* PptxGenJS requires just a few libraries to produce and push a file to web browsers +PptxGenJS requires just three other libraries to produce and push a file to web browsers. + ```javascript - + ``` # Optional Modules -* A complete PowerPoint Shape object array (thanks to ) +If you are planning on creating Shapes (basically anything other than Text, Tables or rectangles), then you'll want to +include the `pptxgen.shapes.js` library. It's a complete PowerPoint PPTX Shape object array thanks to the +[officegen project](https://github.com/Ziv-Barber/officegen) ```javascript - ``` -# Writing Presentation -Creating a Presentation is super easy. +For times when a plain white slide won't due, why not create a Slide Master? (especially useful for corporate environments). See the one in the examples folder to get started +```javascript + +``` + +************************************************************************************************** +# The Basics +* Presentations are composed of 1 or more Slides +* Options are passed via objects (e.g.: `{ x:1.5, y:2.5, font_size:18 }`) +* Shape dimensions and locations are passed in inches +* Not much other than X and Y locations are required are required for most objects -### Creating your first Presentation: +# Creating a Presentation +Creating a Presentation is as easy as 1-2-3: +1. Add a Slide +2. Add any Shapes, Text or Tables +3. Save the Presentation ```javascript -var pptx = new PptxGenJS(); var slide = pptx.addNewSlide(); -slide.addText('Hello World!', { x:0.5, y:0.7, font_size:18, font_face:'Arial', color:'0000FF' }); -pptx.save('HelloWorld'); +slide.addText('Hello World!', { x:0.5, y:0.7, font_size:18, color:'0000FF' }); +pptx.save('Sample Presentation'); ``` -See, that was easy! +************************************************************************************************** +# Table-to-Slides / 1-Click Exports +* With the unique `addSlidesForTable()` function, you can reproduce an HTML table - background colors, borders, fonts, padding, etc. - with a single function call. +* The function will detect margins (based on Master Slide layout or parameters) and will create Slides as needed +* All you have to do is throw a table at the function and you're done! -### The Basics: -* Options are passed via objects -* Height, width and locations are passed in inches -* Not much other than X and Y locations are required +```javascript +// STEP 1: Instantiate new PptxGenJS instance +var pptx = new PptxGenJS(); -### Presentation Options +// STEP 2: Set slide size/layout +pptx.setLayout('LAYOUT_16x9'); + +// STEP 3: Pass table to addSlidesForTable function to produce 1-N slides +pptx.addSlidesForTable('tabAutoPaging'); + +// STEP 4: Export Presentation +pptx.save('Table2SlidesDemo'); +``` + +What about cases where you have a specific Slide Master or Corporate layout to adhere to? +No problem! +Simply pass the Slide Master name and all shapes/text will appear on the output Slides. Even better, +your slide layout/size and margins are already defined as well, so you end up with code you can just inline +into a button and place next to any table on your site. -Setting the Title: ```javascript -pptx.setPresTitle('PptxGenJS Sample Export'); + ``` +### TIP: +* Placing a button like this into a WebPart is a great way to add "Export to PowerPoint" functionality to SharePoint/Office365. (You'd also need to add the 4 `