Permalink
Browse files

Version 0.2.7 - automatic fields

Supporting automatic fields for pptx files.
Some minor bug fixes.
  • Loading branch information...
1 parent ae8c207 commit 24a0b987d729405170e2b9f34940606cdcb13eea @Ziv-Barber committed Jan 9, 2014
Showing with 381 additions and 31 deletions.
  1. +3 −0 .gitignore
  2. +1 −0 .npmignore
  3. +0 −1 .travis.yml
  4. +20 −2 README.md
  5. +11 −0 examples/make_pptx.js
  6. +14 −0 lib/gendocx.js
  7. +218 −22 lib/genpptx.js
  8. +4 −4 lib/genxlsx.js
  9. +32 −1 lib/msofficegen.js
  10. +77 −0 lib/pptxfields.js
  11. +1 −1 package.json
View
@@ -0,0 +1,3 @@
+node_modules
+.DS_Store
+out.*
View
@@ -1,2 +1,3 @@
node_modules/
+.DS_Store/
out.*
View
@@ -3,4 +3,3 @@ node_js:
- "0.11"
- "0.10"
- "0.8"
- - "0.6"
View
@@ -9,6 +9,10 @@ This module is a Javascript porting of my 'DuckWriteC++' library which doing the
## Announcement: ##
+Donations:
+
+I'm accepting tips through Gittip: https://www.gittip.com/Ziv-Barber/
+
OpenOffice document generation support will be added in the future.
Please refer to the roadmap section for information on what will be added in the next versions.
@@ -25,6 +29,7 @@ Please refer to the roadmap section for information on what will be added in the
- [Roadmap](#a9)
- [License](#a10)
- [Credit](#a11)
+- [Donations] (#a12)
<a name="a1"/>
## Features: ##
@@ -37,6 +42,7 @@ Please refer to the roadmap section for information on what will be added in the
- Can declare fonts, alignment, colors and background.
- Support shapes: Ellipse, Rectangle, Line, Arrows, etc.
- Support hidden slides.
+ - Support automatic fields like date, time and current slide number.
- Generating Microsoft Word document (.docx file):
- Create Word document.
- You can add one or more paragraphs to the document and you can set the fonts, colors, alignment, etc.
@@ -412,12 +418,10 @@ pObj.addText ( ' Fonts face and size.', { font_face: 'Arial', font_size: 40 } );
Add an image to a paragraph:
-```js
var path = require('path');
pObj.addImage ( path.resolve(__dirname, 'myFile.png' ) );
pObj.addImage ( path.resolve(__dirname, 'myFile.png', { cx: 300, cy: 200 } ) );
-```
To add a line break;
@@ -484,6 +488,15 @@ https://groups.google.com/forum/?fromgroups#!forum/node-officegen
<a name="a8"/>
## History: ##
+- Version 0.2.7:
+ - PowerPoint:
+ - Automatic updated fields support: date and time, slide number.
+ - Bug fix: The text parameter of addText now supporting also numbers.
+ - addText: simple array support then before (just pass list of strings to add as a text paragraph).
+ - Word:
+ - putPageBreak changed to addPageBreak but you can still use the old name.
+ - Patch by Antoine Proulx: fix the font size converting.
+ - Patch by Antoine Proulx: Proposition for the addition of a line break inside a paragraph.
- Version 0.2.6:
- PowerPoint:
- Automatically support line breaks.
@@ -619,3 +632,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- For creating zip streams i'm using 'archiver' by cmilhench, dbrockman, paulj originally inspired by Antoine van Wel's zipstream.
+<a name="a12"/>
+## Donations: ##
+
+I'm accepting tips through Gittip: https://www.gittip.com/Ziv-Barber/
+
View
@@ -122,6 +122,17 @@ slide.addImage ( path.resolve(__dirname, 'images_for_examples/sword_004.png' ),
slide.addImage ( path.resolve(__dirname, 'images_for_examples/sword_002.png' ), { y: 310, x: 110 } );
slide.addImage ( path.resolve(__dirname, 'images_for_examples/sword_003.png' ), { y: 310, x: 210 } );
+slide = pptx.makeNewSlide ();
+
+slide.addText ( 'Test newline\nAnother line', { y: 10 } );
+slide.addText ( 456, { y: 100 } );
+slide.addText ( [ '123', ' ', 567 ], { y: 150 } );
+slide.addText ( { 'field': 'DATE_TIME' }, { y: 200 } );
+slide.addText ( { 'field': 'SLIDE_NUM' }, { y: 240 } );
+slide.addText ( { 'field': 'DATE_WD_MN_DD_YYYY' }, { y: 280 } );
+slide.addText ( { 'field': 'DATE_DD_SMN_YY' }, { y: 320 } );
+// see pptxfields.js for the list of field types.
+
var out = fs.createWriteStream ( 'out.pptx' );
out.on ( 'error', function ( err ) {
View
@@ -548,6 +548,20 @@ function makeDocx ( genobj, new_type, options, gen_private, type_info ) {
genobj.data[genobj.data.length] = newP;
return newP;
};
+
+ ///
+ /// @brief Add a page break.
+ ///
+ /// This method add a page break to the current Word document.
+ ///
+ genobj.addPageBreak = function () {
+ var newP = {};
+
+ newP.data = [ { 'page_break': true } ];
+
+ genobj.data[genobj.data.length] = newP;
+ return newP;
+ };
}
baseobj.plugins.registerDocType ( 'docx', makeDocx, {}, baseobj.docType.TEXT, "Microsoft Word Document" );
Oops, something went wrong.

0 comments on commit 24a0b98

Please sign in to comment.