diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..e2b2f2bd --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +node_modules +.DS_Store +out.* \ No newline at end of file diff --git a/Gruntfile.js b/Gruntfile.js new file mode 100644 index 00000000..e3e1f45e --- /dev/null +++ b/Gruntfile.js @@ -0,0 +1,36 @@ +module.exports = function(grunt) { + var path = require("path"); + // Project configuration. + grunt.initConfig({ + pkg: grunt.file.readJSON('package.json'), + coffee: { + dynamic_mappings: { + expand: true, + flatten: false, + cwd: 'src/', + src: ['**/*.coffee'], + dest: 'lib/', + ext: '.js' + } + }, + + watch: { + coffee: { + files: ['src/*.coffee'], + tasks: 'coffee' + }, + } + }); + + grunt.event.on('watch', function(action, filepath, target) { + console.log(filepath); + grunt.config(['coffee', 'dynamic_mappings', 'files', 'src'], filepath); + } ); + + // Load the plugin that provides the "less" task. + + grunt.loadNpmTasks('grunt-contrib-watch'); + grunt.loadNpmTasks('grunt-contrib-coffee'); + + grunt.registerTask('default', ['coffee:dynamic_mappings', 'watch']); +}; \ No newline at end of file diff --git a/README.md b/README.md index ed5eabfb..0eab643b 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,13 @@ -# officegen # +# officegen-2 # + +- by vtloc - + +This module were built up-on the original module officegen which weren't published by me. +In this module, I've support the feature of exporting chart ( pie, bar, column ). +But the code is a bit hacky, that's why I've published this module separately. +Used it for your own risks. + +- end by vtloc - This module can generate Office Open XML files (the files been created by Microsoft Office 2007 and later). This module is not depend on any framework so you can use it for any kind of node.js application, even not @@ -37,6 +46,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 - 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. @@ -50,13 +60,13 @@ Please refer to the roadmap section for information on what will be added in the via Git: ```bash -$ git clone git://github.com/Ziv-Barber/officegen.git +$ git clone git://github.com/vtloc/officegen.git ``` via npm: ```bash -$ npm install officegen +$ npm install officegen-2 ``` This module is depending on: @@ -64,6 +74,8 @@ This module is depending on: - archiver - setimmediate - fast-image-size +- underscore +- xmlbuilder ## Public API: ## @@ -260,6 +272,9 @@ The slide object supporting the following methods: - addText ( text, options ) - addShape ( shape, options ) - addImage ( image, options ) +- addPieChart ( data ) +- addColumnChart ( data ) +- addBarChart ( data ) Read only methods: @@ -371,6 +386,94 @@ slide.addText ( 'Boom!!!', { font_face: 'Wide Latin', font_size: 54, color: 'cc0000', bold: true, underline: true } ); ``` +Examples how to add chart into the slide: +```js +// Column chart +slide = pptx.makeNewSlide(); +slide.name = 'Chart slide'; +slide.back = 'ffffff'; +slide.addColumnChart( + { title: 'Column chart', + data: [ // each item is one serie + { + name: 'Income', + labels: ['2005', '2006', '2007', '2008', '2009'], + values: [23.5, 26.2, 30.1, 29.5, 24.6], + color: 'ff0000' // optional + }, + { + name: 'Expense', + labels: ['2005', '2006', '2007', '2008', '2009'], + values: [18.1, 22.8, 23.9, 25.1, 25], + color: '00ff00' // optional + }] + } +) + +// Pie chart +slide = pptx.makeNewSlide(); +slide.name = 'Pie Chart slide'; +slide.back = 'ffff00'; +slide.addPieChart( + { title: 'My production', + data: [ // each item is one serie + { + name: 'Oil', + labels: ['Czech Republic', 'Ireland', 'Germany', 'Australia', 'Austria', 'UK', 'Belgium'], + values: [301, 201, 165, 139, 128, 99, 60], + colors: ['ff0000', '00ff00', '0000ff', 'ffff00', 'ff00ff', '00ffff', '000000'] // optional + }] + } +) + +// Bar Chart +slide = pptx.makeNewSlide(); +slide.name = 'Bar Chart slide'; +slide.back = 'ff00ff'; +slide.addBarChart( + { title: 'Sample bar chart', + data: [ // each item is one serie + { + name: 'europe', + labels: ['Y2003', 'Y2004', 'Y2005'], + values: [2.5, 2.6, 2.8], + color: 'ff0000' // optional + }, + { + name: 'namerica', + labels: ['Y2003', 'Y2004', 'Y2005'], + values: [2.5, 2.7, 2.9], + color: '00ff00' // optional + }, + { + name: 'asia', + labels: ['Y2003', 'Y2004', 'Y2005'], + values: [2.1, 2.2, 2.4], + color: '0000ff' // optional + }, + { + name: 'lamerica', + labels: ['Y2003', 'Y2004', 'Y2005'], + values: [0.3, 0.3, 0.3], + color: 'ffff00' // optional + }, + { + name: 'meast', + labels: ['Y2003', 'Y2004', 'Y2005'], + values: [0.2, 0.3, 0.3], + color: 'ff00ff' // optional + }, + { + name: 'africa', + labels: ['Y2003', 'Y2004', 'Y2005'], + values: [0.1, 0.1, 0.1], + color: '00ffff' // optional + } + + ] + } +) +``` #### Word: #### @@ -474,7 +577,11 @@ https://groups.google.com/forum/?fromgroups#!forum/node-officegen ## History: ## - +- Version 0.3.*: + - PowerPoint: + - Add pie chart + - Add bar chart + - Add column chart - Version 0.2.6: - PowerPoint: - Automatically support line breaks. diff --git a/examples/make_pptx.js b/examples/make_pptx.js index 4c98e487..a59cf451 100644 --- a/examples/make_pptx.js +++ b/examples/make_pptx.js @@ -10,8 +10,10 @@ var slide; var pObj; pptx.on ( 'finalize', function ( written ) { - console.log ( 'Finish to create a PowerPoint file.\nTotal bytes created: ' + written + '\n' ); - }); + console.log ( 'Finish to create a PowerPoint file.\nTotal bytes created: ' + written + '\n' ); + + // clear the temporatory files +}); pptx.on ( 'error', function ( err ) { console.log ( err ); @@ -19,114 +21,260 @@ pptx.on ( 'error', function ( err ) { pptx.setDocTitle ( 'Sample PPTX Document' ); -// Let's create a new slide: -slide = pptx.makeNewSlide (); - -slide.name = 'The first slide!'; +var chartsData = [ + { + title: 'eSurvey chart', + renderType: 'column', + data: + [ + { + name: 'Income', + labels: ['2005', '2006', '2007', '2008', '2009'], + values: [23.5, 26.2, 30.1, 29.5, 24.6], + color: 'ff0000' + }, + { + name: 'Expense', + labels: ['2005', '2006', '2007', '2008', '2009'], + values: [18.1, 22.8, 23.9, 25.1, 25], + color: '00ff00' + } + ] + }, + + { + title: 'My production', + renderType: 'pie', + data: [ + { + name: 'Oil', + labels: ['Czech Republic', 'Ireland', 'Germany', 'Australia', 'Austria', 'UK', 'Belgium'], + values: [301, 201, 165, 139, 128, 99, 60], + colors: ['ff0000', '00ff00', '0000ff', 'ffff00', 'ff00ff', '00ffff', '000000'] + }] + }, + + { + title: 'Sample bar chart', + renderType: 'bar', + data: [ + { + name: 'europe', + labels: ['Y2003', 'Y2004', 'Y2005'], + values: [2.5, 2.6, 2.8], + color: 'ff0000' + }, + { + name: 'namerica', + labels: ['Y2003', 'Y2004', 'Y2005'], + values: [2.5, 2.7, 2.9], + color: '00ff00' + }, + { + name: 'asia', + labels: ['Y2003', 'Y2004', 'Y2005'], + values: [2.1, 2.2, 2.4], + color: '0000ff' + }, + { + name: 'lamerica', + labels: ['Y2003', 'Y2004', 'Y2005'], + values: [0.3, 0.3, 0.3], + color: 'ffff00' + }, + { + name: 'meast', + labels: ['Y2003', 'Y2004', 'Y2005'], + values: [0.2, 0.3, 0.3], + color: 'ff00ff' + }, + { + name: 'africa', + labels: ['Y2003', 'Y2004', 'Y2005'], + values: [0.1, 0.1, 0.1], + color: '00ffff' + } + + ] + }, + + { + title: 'Group bar chart', + renderType: 'group-bar', + data: [ + { + name: 'europe', + labels: ['Y2003', 'Y2004', 'Y2005'], + values: [2.5, 2.6, 2.8], + color: 'ff0000' + }, + { + name: 'namerica', + labels: ['Y2003', 'Y2004', 'Y2005'], + values: [2.5, 2.7, 2.9], + color: '00ff00' + }, + { + name: 'asia', + labels: ['Y2003', 'Y2004', 'Y2005'], + values: [2.1, 2.2, 2.4], + color: '0000ff' + }, + { + name: 'lamerica', + labels: ['Y2003', 'Y2004', 'Y2005'], + values: [0.3, 0.3, 0.3], + color: 'ffff00' + }, + { + name: 'meast', + labels: ['Y2003', 'Y2004', 'Y2005'], + values: [0.2, 0.3, 0.3], + color: 'ff00ff' + }, + { + name: 'africa', + labels: ['Y2003', 'Y2004', 'Y2005'], + values: [0.1, 0.1, 0.1], + color: '00ffff' + } + + ] + } +]; + +var currentIndex = 0; +function generateNextChart(cb) +{ + slide = pptx.makeNewSlide(); + slide.name = 'Chart slide'; + slide.back = 'ffffff'; + console.log('generate chart ' + currentIndex); + slide.addChart(chartsData[currentIndex], chartsData[currentIndex].renderType, function() { + currentIndex++; + if( currentIndex == chartsData.length ) + cb(); + else + generateNextChart(cb); + }, function(err) {}); +} + +generateNextChart( + function() { + // do the rest things here + console.log('finalize'); + + // Let's create a new slide: + slide = pptx.makeNewSlide(); + + slide.name = 'The first slide!'; + + // Change the background color: + slide.back = '000000'; + + // Declare the default color to use on this slide: + slide.color = 'ffffff'; + + // Basic way to add text string: + slide.addText ( 'Created using Officegen version ' + officegen.version ); + slide.addText ( 'Fast position', 0, 20 ); + slide.addText ( 'Full line', 0, 40, '100%', 20 ); + + // Add text box with multi colors and fonts: + slide.addText ( [ + { text: 'Hello ', options: { font_size: 56 } }, + { text: 'World!', options: { font_size: 56, font_face: 'Arial', color: 'ffff00' } } + ], { cx: '75%', cy: 66, y: 150 } ); + // Please note that you can pass object as the text parameter to addText. + + // For a single text just pass a text string to addText: + slide.addText ( 'Office generator', { y: 66, x: 'c', cx: '50%', cy: 60, font_size: 48, color: '0000ff' } ); + + pObj = slide.addText ( 'Boom\nBoom!!!', { y: 100, x: 10, cx: '70%', font_face: 'Wide Latin', font_size: 54, color: 'cc0000', bold: true, underline: true } ); + pObj.options.y += 150; + + // 2nd slide: + slide = pptx.makeNewSlide (); + + // For every color property (including the back color property) you can pass object instead of the color string: + slide.back = { type: 'solid', color: '004400' }; + pObj = slide.addText ( 'Office generator', { y: 'c', x: 0, cx: '100%', cy: 66, font_size: 48, align: 'center', color: { type: 'solid', color: '008800' } } ); + pObj.setShadowEffect ( 'outerShadow', { bottom: true, right: true } ); + + slide = pptx.makeNewSlide (); + + slide.show = false; + slide.addText ( 'Red line', 'ff0000' ); + slide.addShape ( pptx.shapes.OVAL, { fill: { type: 'solid', color: 'ff0000', alpha: 50 }, line: 'ffff00', y: 50, x: 50 } ); + slide.addText ( 'Red box 1', { color: 'ffffff', fill: 'ff0000', line: 'ffff00', line_size: 5, y: 100, rotate: 45 } ); + slide.addShape ( pptx.shapes.LINE, { line: '0000ff', y: 150, x: 150, cy: 0, cx: 300 } ); + slide.addShape ( pptx.shapes.LINE, { line: '0000ff', y: 150, x: 150, cy: 100, cx: 0 } ); + slide.addShape ( pptx.shapes.LINE, { line: '0000ff', y: 249, x: 150, cy: 0, cx: 300 } ); + slide.addShape ( pptx.shapes.LINE, { line: '0000ff', y: 150, x: 449, cy: 100, cx: 0 } ); + slide.addShape ( pptx.shapes.LINE, { line: '000088', y: 150, x: 150, cy: 100, cx: 300 } ); + slide.addShape ( pptx.shapes.LINE, { line: '000088', y: 150, x: 150, cy: 100, cx: 300 } ); + slide.addShape ( pptx.shapes.LINE, { line: '000088', y: 170, x: 150, cy: 100, cx: 300, line_head: 'triangle' } ); + slide.addShape ( pptx.shapes.LINE, { line: '000088', y: 190, x: 150, cy: 100, cx: 300, line_tail: 'triangle' } ); + slide.addShape ( pptx.shapes.LINE, { line: '000088', y: 210, x: 150, cy: 100, cx: 300, line_head: 'stealth', line_tail: 'stealth' } ); + pObj = slide.addShape ( pptx.shapes.LINE ); + pObj.options.line = '008888'; + pObj.options.y = 210; + pObj.options.x = 150; + pObj.options.cy = 100; + pObj.options.cx = 300; + pObj.options.line_head = 'stealth'; + pObj.options.line_tail = 'stealth'; + pObj.options.flip_vertical = true; + slide.addText ( 'Red box 2', { color: 'ffffff', fill: 'ff0000', line: 'ffff00', y: 350, x: 200, shape: pptx.shapes.ROUNDED_RECTANGLE, indentLevel: 1 } ); + + slide = pptx.makeNewSlide (); + + slide.addImage ( path.resolve(__dirname, 'images_for_examples/image1.png' ), { y: 'c', x: 'c' } ); + + slide = pptx.makeNewSlide (); + + slide.addImage ( path.resolve(__dirname, 'images_for_examples/image2.jpg' ), { y: 0, x: 0, cy: '100%', cx: '100%' } ); + + slide = pptx.makeNewSlide (); + + slide.addImage ( path.resolve(__dirname, 'images_for_examples/image3.png' ), { y: 'c', x: 'c' } ); + + slide = pptx.makeNewSlide (); + + slide.addImage ( path.resolve(__dirname, 'images_for_examples/image2.jpg' ), { y: 0, x: 0, cy: '100%', cx: '100%' } ); + + slide = pptx.makeNewSlide (); + + slide.addImage ( path.resolve(__dirname, 'images_for_examples/image2.jpg' ), { y: 0, x: 0, cy: '100%', cx: '100%' } ); + slide.addImage ( path.resolve(__dirname, 'images_for_examples/sword_001.png' ), { y: 10, x: 10 } ); + slide.addImage ( path.resolve(__dirname, 'images_for_examples/sword_002.png' ), { y: 10, x: 110 } ); + slide.addImage ( path.resolve(__dirname, 'images_for_examples/sword_001.png' ), { y: 110, x: 10 } ); + slide.addImage ( path.resolve(__dirname, 'images_for_examples/sword_001.png' ), { y: 110, x: 110 } ); + + slide = pptx.makeNewSlide (); + + slide.addImage ( path.resolve(__dirname, 'images_for_examples/image2.jpg' ), { y: 0, x: 0, cy: '100%', cx: '100%' } ); + slide.addImage ( path.resolve(__dirname, 'images_for_examples/sword_001.png' ), { y: 10, x: 10 } ); + slide.addImage ( path.resolve(__dirname, 'images_for_examples/sword_002.png' ), 110, 10 ); + slide.addImage ( path.resolve(__dirname, 'images_for_examples/sword_003.png' ), { y: 10, x: 210 } ); + slide.addImage ( path.resolve(__dirname, 'images_for_examples/sword_004.png' ), { y: 110, x: 10 } ); + slide.addImage ( path.resolve(__dirname, 'images_for_examples/sword_001.png' ), { y: 110, x: 110 } ); + slide.addImage ( path.resolve(__dirname, 'images_for_examples/sword_003.png' ), { y: 110, x: 210 } ); + slide.addImage ( path.resolve(__dirname, 'images_for_examples/sword_002.png' ), { y: 210, x: 10 } ); + slide.addImage ( path.resolve(__dirname, 'images_for_examples/sword_004.png' ), { y: 210, x: 110 } ); + slide.addImage ( path.resolve(__dirname, 'images_for_examples/sword_004.png' ), { y: 210, x: 210 } ); + slide.addImage ( path.resolve(__dirname, 'images_for_examples/sword_004.png' ), { y: '310', x: 10 } ); + 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 } ); + + var out = fs.createWriteStream ( 'out.pptx' ); + + out.on ( 'error', function ( err ) { + console.log ( err ); + }); -// Change the background color: -slide.back = '000000'; - -// Declare the default color to use on this slide: -slide.color = 'ffffff'; - -// Basic way to add text string: -slide.addText ( 'Created using Officegen version ' + officegen.version ); -slide.addText ( 'Fast position', 0, 20 ); -slide.addText ( 'Full line', 0, 40, '100%', 20 ); - -// Add text box with multi colors and fonts: -slide.addText ( [ - { text: 'Hello ', options: { font_size: 56 } }, - { text: 'World!', options: { font_size: 56, font_face: 'Arial', color: 'ffff00' } } - ], { cx: '75%', cy: 66, y: 150 } ); -// Please note that you can pass object as the text parameter to addText. - -// For a single text just pass a text string to addText: -slide.addText ( 'Office generator', { y: 66, x: 'c', cx: '50%', cy: 60, font_size: 48, color: '0000ff' } ); - -pObj = slide.addText ( 'Boom\nBoom!!!', { y: 100, x: 10, cx: '70%', font_face: 'Wide Latin', font_size: 54, color: 'cc0000', bold: true, underline: true } ); -pObj.options.y += 150; - -// 2nd slide: -slide = pptx.makeNewSlide (); - -// For every color property (including the back color property) you can pass object instead of the color string: -slide.back = { type: 'solid', color: '004400' }; -pObj = slide.addText ( 'Office generator', { y: 'c', x: 0, cx: '100%', cy: 66, font_size: 48, align: 'center', color: { type: 'solid', color: '008800' } } ); -pObj.setShadowEffect ( 'outerShadow', { bottom: true, right: true } ); - -slide = pptx.makeNewSlide (); - -slide.show = false; -slide.addText ( 'Red line', 'ff0000' ); -slide.addShape ( pptx.shapes.OVAL, { fill: { type: 'solid', color: 'ff0000', alpha: 50 }, line: 'ffff00', y: 50, x: 50 } ); -slide.addText ( 'Red box 1', { color: 'ffffff', fill: 'ff0000', line: 'ffff00', line_size: 5, y: 100, rotate: 45 } ); -slide.addShape ( pptx.shapes.LINE, { line: '0000ff', y: 150, x: 150, cy: 0, cx: 300 } ); -slide.addShape ( pptx.shapes.LINE, { line: '0000ff', y: 150, x: 150, cy: 100, cx: 0 } ); -slide.addShape ( pptx.shapes.LINE, { line: '0000ff', y: 249, x: 150, cy: 0, cx: 300 } ); -slide.addShape ( pptx.shapes.LINE, { line: '0000ff', y: 150, x: 449, cy: 100, cx: 0 } ); -slide.addShape ( pptx.shapes.LINE, { line: '000088', y: 150, x: 150, cy: 100, cx: 300 } ); -slide.addShape ( pptx.shapes.LINE, { line: '000088', y: 150, x: 150, cy: 100, cx: 300 } ); -slide.addShape ( pptx.shapes.LINE, { line: '000088', y: 170, x: 150, cy: 100, cx: 300, line_head: 'triangle' } ); -slide.addShape ( pptx.shapes.LINE, { line: '000088', y: 190, x: 150, cy: 100, cx: 300, line_tail: 'triangle' } ); -slide.addShape ( pptx.shapes.LINE, { line: '000088', y: 210, x: 150, cy: 100, cx: 300, line_head: 'stealth', line_tail: 'stealth' } ); -pObj = slide.addShape ( pptx.shapes.LINE ); -pObj.options.line = '008888'; -pObj.options.y = 210; -pObj.options.x = 150; -pObj.options.cy = 100; -pObj.options.cx = 300; -pObj.options.line_head = 'stealth'; -pObj.options.line_tail = 'stealth'; -pObj.options.flip_vertical = true; -slide.addText ( 'Red box 2', { color: 'ffffff', fill: 'ff0000', line: 'ffff00', y: 350, x: 200, shape: pptx.shapes.ROUNDED_RECTANGLE, indentLevel: 1 } ); - -slide = pptx.makeNewSlide (); - -slide.addImage ( path.resolve(__dirname, 'images_for_examples/image1.png' ), { y: 'c', x: 'c' } ); - -slide = pptx.makeNewSlide (); - -slide.addImage ( path.resolve(__dirname, 'images_for_examples/image2.jpg' ), { y: 0, x: 0, cy: '100%', cx: '100%' } ); - -slide = pptx.makeNewSlide (); - -slide.addImage ( path.resolve(__dirname, 'images_for_examples/image3.png' ), { y: 'c', x: 'c' } ); - -slide = pptx.makeNewSlide (); - -slide.addImage ( path.resolve(__dirname, 'images_for_examples/image2.jpg' ), { y: 0, x: 0, cy: '100%', cx: '100%' } ); - -slide = pptx.makeNewSlide (); - -slide.addImage ( path.resolve(__dirname, 'images_for_examples/image2.jpg' ), { y: 0, x: 0, cy: '100%', cx: '100%' } ); -slide.addImage ( path.resolve(__dirname, 'images_for_examples/sword_001.png' ), { y: 10, x: 10 } ); -slide.addImage ( path.resolve(__dirname, 'images_for_examples/sword_002.png' ), { y: 10, x: 110 } ); -slide.addImage ( path.resolve(__dirname, 'images_for_examples/sword_001.png' ), { y: 110, x: 10 } ); -slide.addImage ( path.resolve(__dirname, 'images_for_examples/sword_001.png' ), { y: 110, x: 110 } ); - -slide = pptx.makeNewSlide (); - -slide.addImage ( path.resolve(__dirname, 'images_for_examples/image2.jpg' ), { y: 0, x: 0, cy: '100%', cx: '100%' } ); -slide.addImage ( path.resolve(__dirname, 'images_for_examples/sword_001.png' ), { y: 10, x: 10 } ); -slide.addImage ( path.resolve(__dirname, 'images_for_examples/sword_002.png' ), 110, 10 ); -slide.addImage ( path.resolve(__dirname, 'images_for_examples/sword_003.png' ), { y: 10, x: 210 } ); -slide.addImage ( path.resolve(__dirname, 'images_for_examples/sword_004.png' ), { y: 110, x: 10 } ); -slide.addImage ( path.resolve(__dirname, 'images_for_examples/sword_001.png' ), { y: 110, x: 110 } ); -slide.addImage ( path.resolve(__dirname, 'images_for_examples/sword_003.png' ), { y: 110, x: 210 } ); -slide.addImage ( path.resolve(__dirname, 'images_for_examples/sword_002.png' ), { y: 210, x: 10 } ); -slide.addImage ( path.resolve(__dirname, 'images_for_examples/sword_004.png' ), { y: 210, x: 110 } ); -slide.addImage ( path.resolve(__dirname, 'images_for_examples/sword_004.png' ), { y: 210, x: 210 } ); -slide.addImage ( path.resolve(__dirname, 'images_for_examples/sword_004.png' ), { y: '310', x: 10 } ); -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 } ); - -var out = fs.createWriteStream ( 'out.pptx' ); - -out.on ( 'error', function ( err ) { - console.log ( err ); -}); + pptx.generate ( out ); + } +); -pptx.generate ( out ); diff --git a/examples/pptx_server.js b/examples/pptx_server.js index 46f7e440..a21b7088 100644 --- a/examples/pptx_server.js +++ b/examples/pptx_server.js @@ -6,6 +6,8 @@ var officegen = require('../lib/index.js'); var fs = require('fs'); var http = require("http"); var querystring = require('querystring'); +var path = require('path'); + function postRequest ( request, response, callback ) { var queryData = ""; @@ -72,20 +74,248 @@ http.createServer ( function ( request, response ) { console.log ( err ); }); - slide = pptx.makeNewSlide (); - slide.back = '000000'; - slide.color = 'ffffff'; + + var chartsData = [ + { + title: 'eSurvey chart', + renderType: 'column', + data: + [ + { + name: 'Income', + labels: ['2005', '2006', '2007', '2008', '2009'], + values: [23.5, 26.2, 30.1, 29.5, 24.6] + }, + { + name: 'Expense', + labels: ['2005', '2006', '2007', '2008', '2009'], + values: [18.1, 22.8, 23.9, 25.1, 25] + } + ] + }, + + { + title: 'My production', + renderType: 'pie', + data: [ + { + name: 'Oil', + labels: ['Czech Republic', 'Ireland', 'Germany', 'Australia', 'Austria', 'UK', 'Belgium'], + values: [301, 201, 165, 139, 128, 99, 60] + }] + }, + + { + title: 'Sample bar chart', + renderType: 'bar', + data: [ + { + name: 'europe', + labels: ['Y2003', 'Y2004', 'Y2005'], + values: [2.5, 2.6, 2.8] + }, + { + name: 'namerica', + labels: ['Y2003', 'Y2004', 'Y2005'], + values: [2.5, 2.7, 2.9] + }, + { + name: 'asia', + labels: ['Y2003', 'Y2004', 'Y2005'], + values: [2.1, 2.2, 2.4] + }, + { + name: 'lamerica', + labels: ['Y2003', 'Y2004', 'Y2005'], + values: [0.3, 0.3, 0.3] + }, + { + name: 'meast', + labels: ['Y2003', 'Y2004', 'Y2005'], + values: [0.2, 0.3, 0.3] + }, + { + name: 'africa', + labels: ['Y2003', 'Y2004', 'Y2005'], + values: [0.1, 0.1, 0.1] + } + + ] + }, + + { + title: 'Group bar chart', + renderType: 'group-bar', + data: [ + { + name: 'europe', + labels: ['Y2003', 'Y2004', 'Y2005'], + values: [2.5, 2.6, 2.8] + }, + { + name: 'namerica', + labels: ['Y2003', 'Y2004', 'Y2005'], + values: [2.5, 2.7, 2.9] + }, + { + name: 'asia', + labels: ['Y2003', 'Y2004', 'Y2005'], + values: [2.1, 2.2, 2.4] + }, + { + name: 'lamerica', + labels: ['Y2003', 'Y2004', 'Y2005'], + values: [0.3, 0.3, 0.3] + }, + { + name: 'meast', + labels: ['Y2003', 'Y2004', 'Y2005'], + values: [0.2, 0.3, 0.3] + }, + { + name: 'africa', + labels: ['Y2003', 'Y2004', 'Y2005'], + values: [0.1, 0.1, 0.1] + } + + ] + } + ]; + + var currentIndex = 0; + function generateNextChart(cb) + { + slide = pptx.makeNewSlide(); + slide.name = 'Chart slide'; + slide.back = 'ffffff'; + console.log('generate chart ' + currentIndex); + slide.addChart(chartsData[0], chartsData[0].renderType, function() { + currentIndex++; + if( currentIndex == 100) + cb(); + else + generateNextChart(cb); + }, function(err) {}); + } + + generateNextChart( + function() { + // do the rest things here + console.log('finalize'); + + // Let's create a new slide: + slide = pptx.makeNewSlide(); + + slide.name = 'The first slide!'; + + // Change the background color: + slide.back = '000000'; + + // Declare the default color to use on this slide: + slide.color = 'ffffff'; + + // Basic way to add text string: + slide.addText ( 'Created using Officegen version ' + officegen.version ); + slide.addText ( 'Fast position', 0, 20 ); + slide.addText ( 'Full line', 0, 40, '100%', 20 ); + + // Add text box with multi colors and fonts: + slide.addText ( [ + { text: 'Hello ', options: { font_size: 56 } }, + { text: 'World!', options: { font_size: 56, font_face: 'Arial', color: 'ffff00' } } + ], { cx: '75%', cy: 66, y: 150 } ); + // Please note that you can pass object as the text parameter to addText. + + // For a single text just pass a text string to addText: + slide.addText ( 'Office generator', { y: 66, x: 'c', cx: '50%', cy: 60, font_size: 48, color: '0000ff' } ); + + pObj = slide.addText ( 'Boom\nBoom!!!', { y: 100, x: 10, cx: '70%', font_face: 'Wide Latin', font_size: 54, color: 'cc0000', bold: true, underline: true } ); + pObj.options.y += 150; + + // 2nd slide: + slide = pptx.makeNewSlide (); + + // For every color property (including the back color property) you can pass object instead of the color string: + slide.back = { type: 'solid', color: '004400' }; + pObj = slide.addText ( 'Office generator', { y: 'c', x: 0, cx: '100%', cy: 66, font_size: 48, align: 'center', color: { type: 'solid', color: '008800' } } ); + pObj.setShadowEffect ( 'outerShadow', { bottom: true, right: true } ); + + slide = pptx.makeNewSlide (); + + slide.show = false; + slide.addText ( 'Red line', 'ff0000' ); + slide.addShape ( pptx.shapes.OVAL, { fill: { type: 'solid', color: 'ff0000', alpha: 50 }, line: 'ffff00', y: 50, x: 50 } ); + slide.addText ( 'Red box 1', { color: 'ffffff', fill: 'ff0000', line: 'ffff00', line_size: 5, y: 100, rotate: 45 } ); + slide.addShape ( pptx.shapes.LINE, { line: '0000ff', y: 150, x: 150, cy: 0, cx: 300 } ); + slide.addShape ( pptx.shapes.LINE, { line: '0000ff', y: 150, x: 150, cy: 100, cx: 0 } ); + slide.addShape ( pptx.shapes.LINE, { line: '0000ff', y: 249, x: 150, cy: 0, cx: 300 } ); + slide.addShape ( pptx.shapes.LINE, { line: '0000ff', y: 150, x: 449, cy: 100, cx: 0 } ); + slide.addShape ( pptx.shapes.LINE, { line: '000088', y: 150, x: 150, cy: 100, cx: 300 } ); + slide.addShape ( pptx.shapes.LINE, { line: '000088', y: 150, x: 150, cy: 100, cx: 300 } ); + slide.addShape ( pptx.shapes.LINE, { line: '000088', y: 170, x: 150, cy: 100, cx: 300, line_head: 'triangle' } ); + slide.addShape ( pptx.shapes.LINE, { line: '000088', y: 190, x: 150, cy: 100, cx: 300, line_tail: 'triangle' } ); + slide.addShape ( pptx.shapes.LINE, { line: '000088', y: 210, x: 150, cy: 100, cx: 300, line_head: 'stealth', line_tail: 'stealth' } ); + pObj = slide.addShape ( pptx.shapes.LINE ); + pObj.options.line = '008888'; + pObj.options.y = 210; + pObj.options.x = 150; + pObj.options.cy = 100; + pObj.options.cx = 300; + pObj.options.line_head = 'stealth'; + pObj.options.line_tail = 'stealth'; + pObj.options.flip_vertical = true; + slide.addText ( 'Red box 2', { color: 'ffffff', fill: 'ff0000', line: 'ffff00', y: 350, x: 200, shape: pptx.shapes.ROUNDED_RECTANGLE, indentLevel: 1 } ); - slide.addText ( 'Hello ' + response.post.name + '!', { y: 20, cx: '100%', font_size: 56, font_face: 'Arial', bold: true, color: 'ffff00', align: 'center' } ); + slide = pptx.makeNewSlide (); - slide.addText ( 'Requested URL', { y: 150, cx: '50%' } ); - slide.addText ( request.url, { y: 150, x: '50%', cx: '50%', color: '0000ff' } ); - slide.addText ( 'Request Method', { y: 180, cx: '50%' } ); - slide.addText ( request.method, { y: 180, x: '50%', cx: '50%', color: '0000ff' } ); - slide.addText ( 'Request Dara', { y: 210, cx: '50%' } ); - slide.addText ( response.post.name, { y: 210, x: '50%', cx: '50%', color: '0000ff' } ); + slide.addImage ( path.resolve(__dirname, 'images_for_examples/image1.png' ), { y: 'c', x: 'c' } ); + + slide = pptx.makeNewSlide (); + + slide.addImage ( path.resolve(__dirname, 'images_for_examples/image2.jpg' ), { y: 0, x: 0, cy: '100%', cx: '100%' } ); + + slide = pptx.makeNewSlide (); + + slide.addImage ( path.resolve(__dirname, 'images_for_examples/image3.png' ), { y: 'c', x: 'c' } ); + + slide = pptx.makeNewSlide (); + + slide.addImage ( path.resolve(__dirname, 'images_for_examples/image2.jpg' ), { y: 0, x: 0, cy: '100%', cx: '100%' } ); + + slide = pptx.makeNewSlide (); + + slide.addImage ( path.resolve(__dirname, 'images_for_examples/image2.jpg' ), { y: 0, x: 0, cy: '100%', cx: '100%' } ); + slide.addImage ( path.resolve(__dirname, 'images_for_examples/sword_001.png' ), { y: 10, x: 10 } ); + slide.addImage ( path.resolve(__dirname, 'images_for_examples/sword_002.png' ), { y: 10, x: 110 } ); + slide.addImage ( path.resolve(__dirname, 'images_for_examples/sword_001.png' ), { y: 110, x: 10 } ); + slide.addImage ( path.resolve(__dirname, 'images_for_examples/sword_001.png' ), { y: 110, x: 110 } ); + + slide = pptx.makeNewSlide (); + + slide.addImage ( path.resolve(__dirname, 'images_for_examples/image2.jpg' ), { y: 0, x: 0, cy: '100%', cx: '100%' } ); + slide.addImage ( path.resolve(__dirname, 'images_for_examples/sword_001.png' ), { y: 10, x: 10 } ); + slide.addImage ( path.resolve(__dirname, 'images_for_examples/sword_002.png' ), 110, 10 ); + slide.addImage ( path.resolve(__dirname, 'images_for_examples/sword_003.png' ), { y: 10, x: 210 } ); + slide.addImage ( path.resolve(__dirname, 'images_for_examples/sword_004.png' ), { y: 110, x: 10 } ); + slide.addImage ( path.resolve(__dirname, 'images_for_examples/sword_001.png' ), { y: 110, x: 110 } ); + slide.addImage ( path.resolve(__dirname, 'images_for_examples/sword_003.png' ), { y: 110, x: 210 } ); + slide.addImage ( path.resolve(__dirname, 'images_for_examples/sword_002.png' ), { y: 210, x: 10 } ); + slide.addImage ( path.resolve(__dirname, 'images_for_examples/sword_004.png' ), { y: 210, x: 110 } ); + slide.addImage ( path.resolve(__dirname, 'images_for_examples/sword_004.png' ), { y: 210, x: 210 } ); + slide.addImage ( path.resolve(__dirname, 'images_for_examples/sword_004.png' ), { y: '310', x: 10 } ); + 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 } ); + + var out = fs.createWriteStream ( 'out.pptx' ); + + out.on ( 'error', function ( err ) { + console.log ( err ); + }); - pptx.generate ( response ); + pptx.generate ( response ); + } + ); + }); } // Endif. }).listen ( 3000 ); diff --git a/experiments/out-1-nochart.pptx b/experiments/out-1-nochart.pptx new file mode 100644 index 00000000..663b8b72 Binary files /dev/null and b/experiments/out-1-nochart.pptx differ diff --git a/experiments/out-1-nochart/[Content_Types].xml b/experiments/out-1-nochart/[Content_Types].xml new file mode 100644 index 00000000..b4d73afc --- /dev/null +++ b/experiments/out-1-nochart/[Content_Types].xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-nochart/_rels/.rels b/experiments/out-1-nochart/_rels/.rels new file mode 100644 index 00000000..80812298 --- /dev/null +++ b/experiments/out-1-nochart/_rels/.rels @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-nochart/docProps/app.xml b/experiments/out-1-nochart/docProps/app.xml new file mode 100644 index 00000000..93787d25 --- /dev/null +++ b/experiments/out-1-nochart/docProps/app.xml @@ -0,0 +1,2 @@ + +1327Microsoft Office PowerPointOn-screen Show (4:3)1110010falseFonts Used3Theme1Slide Titles10ArialCalibriWide LatinOffice ThemePowerPoint PresentationPowerPoint PresentationPowerPoint PresentationPowerPoint PresentationPowerPoint PresentationPowerPoint PresentationPowerPoint PresentationPowerPoint PresentationPowerPoint PresentationPowerPoint Presentationofficegenfalsefalsefalse15.0000 \ No newline at end of file diff --git a/experiments/out-1-nochart/docProps/core.xml b/experiments/out-1-nochart/docProps/core.xml new file mode 100644 index 00000000..92268a66 --- /dev/null +++ b/experiments/out-1-nochart/docProps/core.xml @@ -0,0 +1,2 @@ + +Sample PPTX DocumentofficegenVo Thanh Loc12013-12-30T17:19:02Z2013-12-30T10:32:35Z \ No newline at end of file diff --git a/experiments/out-1-nochart/ppt/_rels/presentation.xml.rels b/experiments/out-1-nochart/ppt/_rels/presentation.xml.rels new file mode 100644 index 00000000..26f24cb3 --- /dev/null +++ b/experiments/out-1-nochart/ppt/_rels/presentation.xml.rels @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-nochart/ppt/media/image1.png b/experiments/out-1-nochart/ppt/media/image1.png new file mode 100644 index 00000000..ddcbf8ce Binary files /dev/null and b/experiments/out-1-nochart/ppt/media/image1.png differ diff --git a/experiments/out-1-nochart/ppt/media/image2.jpeg b/experiments/out-1-nochart/ppt/media/image2.jpeg new file mode 100644 index 00000000..7e96fe6a Binary files /dev/null and b/experiments/out-1-nochart/ppt/media/image2.jpeg differ diff --git a/experiments/out-1-nochart/ppt/media/image3.png b/experiments/out-1-nochart/ppt/media/image3.png new file mode 100644 index 00000000..557096ea Binary files /dev/null and b/experiments/out-1-nochart/ppt/media/image3.png differ diff --git a/experiments/out-1-nochart/ppt/media/image4.png b/experiments/out-1-nochart/ppt/media/image4.png new file mode 100644 index 00000000..f6124ad7 Binary files /dev/null and b/experiments/out-1-nochart/ppt/media/image4.png differ diff --git a/experiments/out-1-nochart/ppt/media/image5.png b/experiments/out-1-nochart/ppt/media/image5.png new file mode 100644 index 00000000..34ca2bd8 Binary files /dev/null and b/experiments/out-1-nochart/ppt/media/image5.png differ diff --git a/experiments/out-1-nochart/ppt/media/image6.png b/experiments/out-1-nochart/ppt/media/image6.png new file mode 100644 index 00000000..7ffffa3b Binary files /dev/null and b/experiments/out-1-nochart/ppt/media/image6.png differ diff --git a/experiments/out-1-nochart/ppt/media/image7.png b/experiments/out-1-nochart/ppt/media/image7.png new file mode 100644 index 00000000..1b9cc19f Binary files /dev/null and b/experiments/out-1-nochart/ppt/media/image7.png differ diff --git a/experiments/out-1-nochart/ppt/presProps.xml b/experiments/out-1-nochart/ppt/presProps.xml new file mode 100644 index 00000000..501bd048 --- /dev/null +++ b/experiments/out-1-nochart/ppt/presProps.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-nochart/ppt/presentation.xml b/experiments/out-1-nochart/ppt/presentation.xml new file mode 100644 index 00000000..fe53519c --- /dev/null +++ b/experiments/out-1-nochart/ppt/presentation.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-nochart/ppt/slideLayouts/_rels/slideLayout1.xml.rels b/experiments/out-1-nochart/ppt/slideLayouts/_rels/slideLayout1.xml.rels new file mode 100644 index 00000000..69d8ac58 --- /dev/null +++ b/experiments/out-1-nochart/ppt/slideLayouts/_rels/slideLayout1.xml.rels @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-nochart/ppt/slideLayouts/slideLayout1.xml b/experiments/out-1-nochart/ppt/slideLayouts/slideLayout1.xml new file mode 100644 index 00000000..9db54a89 --- /dev/null +++ b/experiments/out-1-nochart/ppt/slideLayouts/slideLayout1.xml @@ -0,0 +1,2 @@ + +Click to edit Master title styleClick to edit Master subtitle style12/30/2013‹#› \ No newline at end of file diff --git a/experiments/out-1-nochart/ppt/slideMasters/_rels/slideMaster1.xml.rels b/experiments/out-1-nochart/ppt/slideMasters/_rels/slideMaster1.xml.rels new file mode 100644 index 00000000..40bf0c97 --- /dev/null +++ b/experiments/out-1-nochart/ppt/slideMasters/_rels/slideMaster1.xml.rels @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-nochart/ppt/slideMasters/slideMaster1.xml b/experiments/out-1-nochart/ppt/slideMasters/slideMaster1.xml new file mode 100644 index 00000000..415f756d --- /dev/null +++ b/experiments/out-1-nochart/ppt/slideMasters/slideMaster1.xml @@ -0,0 +1,2 @@ + +Click to edit Master title styleClick to edit Master text stylesSecond levelThird levelFourth levelFifth level12/30/2013‹#› \ No newline at end of file diff --git a/experiments/out-1-nochart/ppt/slides/_rels/slide1.xml.rels b/experiments/out-1-nochart/ppt/slides/_rels/slide1.xml.rels new file mode 100644 index 00000000..593c255e --- /dev/null +++ b/experiments/out-1-nochart/ppt/slides/_rels/slide1.xml.rels @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-nochart/ppt/slides/_rels/slide10.xml.rels b/experiments/out-1-nochart/ppt/slides/_rels/slide10.xml.rels new file mode 100644 index 00000000..471fc073 --- /dev/null +++ b/experiments/out-1-nochart/ppt/slides/_rels/slide10.xml.rels @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-nochart/ppt/slides/_rels/slide2.xml.rels b/experiments/out-1-nochart/ppt/slides/_rels/slide2.xml.rels new file mode 100644 index 00000000..593c255e --- /dev/null +++ b/experiments/out-1-nochart/ppt/slides/_rels/slide2.xml.rels @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-nochart/ppt/slides/_rels/slide3.xml.rels b/experiments/out-1-nochart/ppt/slides/_rels/slide3.xml.rels new file mode 100644 index 00000000..593c255e --- /dev/null +++ b/experiments/out-1-nochart/ppt/slides/_rels/slide3.xml.rels @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-nochart/ppt/slides/_rels/slide4.xml.rels b/experiments/out-1-nochart/ppt/slides/_rels/slide4.xml.rels new file mode 100644 index 00000000..593c255e --- /dev/null +++ b/experiments/out-1-nochart/ppt/slides/_rels/slide4.xml.rels @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-nochart/ppt/slides/_rels/slide5.xml.rels b/experiments/out-1-nochart/ppt/slides/_rels/slide5.xml.rels new file mode 100644 index 00000000..06c5caa0 --- /dev/null +++ b/experiments/out-1-nochart/ppt/slides/_rels/slide5.xml.rels @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-nochart/ppt/slides/_rels/slide6.xml.rels b/experiments/out-1-nochart/ppt/slides/_rels/slide6.xml.rels new file mode 100644 index 00000000..0ba455cf --- /dev/null +++ b/experiments/out-1-nochart/ppt/slides/_rels/slide6.xml.rels @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-nochart/ppt/slides/_rels/slide7.xml.rels b/experiments/out-1-nochart/ppt/slides/_rels/slide7.xml.rels new file mode 100644 index 00000000..baeadab9 --- /dev/null +++ b/experiments/out-1-nochart/ppt/slides/_rels/slide7.xml.rels @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-nochart/ppt/slides/_rels/slide8.xml.rels b/experiments/out-1-nochart/ppt/slides/_rels/slide8.xml.rels new file mode 100644 index 00000000..0ba455cf --- /dev/null +++ b/experiments/out-1-nochart/ppt/slides/_rels/slide8.xml.rels @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-nochart/ppt/slides/_rels/slide9.xml.rels b/experiments/out-1-nochart/ppt/slides/_rels/slide9.xml.rels new file mode 100644 index 00000000..65b3775a --- /dev/null +++ b/experiments/out-1-nochart/ppt/slides/_rels/slide9.xml.rels @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-nochart/ppt/slides/slide1.xml b/experiments/out-1-nochart/ppt/slides/slide1.xml new file mode 100644 index 00000000..f3908ec7 --- /dev/null +++ b/experiments/out-1-nochart/ppt/slides/slide1.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-nochart/ppt/slides/slide10.xml b/experiments/out-1-nochart/ppt/slides/slide10.xml new file mode 100644 index 00000000..5ab4c3ce --- /dev/null +++ b/experiments/out-1-nochart/ppt/slides/slide10.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-nochart/ppt/slides/slide2.xml b/experiments/out-1-nochart/ppt/slides/slide2.xml new file mode 100644 index 00000000..ee72ae92 --- /dev/null +++ b/experiments/out-1-nochart/ppt/slides/slide2.xml @@ -0,0 +1,2 @@ + +Created using Officegen version 0.2.6Fast positionFull lineHello World!Office generatorBoomBoom!!! \ No newline at end of file diff --git a/experiments/out-1-nochart/ppt/slides/slide3.xml b/experiments/out-1-nochart/ppt/slides/slide3.xml new file mode 100644 index 00000000..b8a1ba59 --- /dev/null +++ b/experiments/out-1-nochart/ppt/slides/slide3.xml @@ -0,0 +1,2 @@ + +Office generator \ No newline at end of file diff --git a/experiments/out-1-nochart/ppt/slides/slide4.xml b/experiments/out-1-nochart/ppt/slides/slide4.xml new file mode 100644 index 00000000..08911fa5 --- /dev/null +++ b/experiments/out-1-nochart/ppt/slides/slide4.xml @@ -0,0 +1,2 @@ + +Red lineRed box 1Red box 2 \ No newline at end of file diff --git a/experiments/out-1-nochart/ppt/slides/slide5.xml b/experiments/out-1-nochart/ppt/slides/slide5.xml new file mode 100644 index 00000000..74c996e7 --- /dev/null +++ b/experiments/out-1-nochart/ppt/slides/slide5.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-nochart/ppt/slides/slide6.xml b/experiments/out-1-nochart/ppt/slides/slide6.xml new file mode 100644 index 00000000..8d505524 --- /dev/null +++ b/experiments/out-1-nochart/ppt/slides/slide6.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-nochart/ppt/slides/slide7.xml b/experiments/out-1-nochart/ppt/slides/slide7.xml new file mode 100644 index 00000000..ad3fe1e8 --- /dev/null +++ b/experiments/out-1-nochart/ppt/slides/slide7.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-nochart/ppt/slides/slide8.xml b/experiments/out-1-nochart/ppt/slides/slide8.xml new file mode 100644 index 00000000..8d505524 --- /dev/null +++ b/experiments/out-1-nochart/ppt/slides/slide8.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-nochart/ppt/slides/slide9.xml b/experiments/out-1-nochart/ppt/slides/slide9.xml new file mode 100644 index 00000000..44db8ba4 --- /dev/null +++ b/experiments/out-1-nochart/ppt/slides/slide9.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-nochart/ppt/tableStyles.xml b/experiments/out-1-nochart/ppt/tableStyles.xml new file mode 100644 index 00000000..0dd0dff2 --- /dev/null +++ b/experiments/out-1-nochart/ppt/tableStyles.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-nochart/ppt/theme/theme1.xml b/experiments/out-1-nochart/ppt/theme/theme1.xml new file mode 100644 index 00000000..ee953eb6 --- /dev/null +++ b/experiments/out-1-nochart/ppt/theme/theme1.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-nochart/ppt/viewProps.xml b/experiments/out-1-nochart/ppt/viewProps.xml new file mode 100644 index 00000000..af60f095 --- /dev/null +++ b/experiments/out-1-nochart/ppt/viewProps.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withbarchart.pptx b/experiments/out-1-withbarchart.pptx new file mode 100644 index 00000000..2d4c5b29 Binary files /dev/null and b/experiments/out-1-withbarchart.pptx differ diff --git a/experiments/out-1-withbarchart/[Content_Types].xml b/experiments/out-1-withbarchart/[Content_Types].xml new file mode 100644 index 00000000..96fb4996 --- /dev/null +++ b/experiments/out-1-withbarchart/[Content_Types].xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withbarchart/_rels/.rels b/experiments/out-1-withbarchart/_rels/.rels new file mode 100644 index 00000000..80812298 --- /dev/null +++ b/experiments/out-1-withbarchart/_rels/.rels @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withbarchart/docProps/app.xml b/experiments/out-1-withbarchart/docProps/app.xml new file mode 100644 index 00000000..b1f8a5c8 --- /dev/null +++ b/experiments/out-1-withbarchart/docProps/app.xml @@ -0,0 +1,2 @@ + +1329Microsoft Office PowerPointOn-screen Show (4:3)1210010falseFonts Used3Theme1Slide Titles10ArialCalibriWide LatinOffice ThemePowerPoint PresentationPowerPoint PresentationPowerPoint PresentationPowerPoint PresentationPowerPoint PresentationPowerPoint PresentationPowerPoint PresentationPowerPoint PresentationPowerPoint PresentationPowerPoint Presentationofficegenfalsefalsefalse15.0000 \ No newline at end of file diff --git a/experiments/out-1-withbarchart/docProps/core.xml b/experiments/out-1-withbarchart/docProps/core.xml new file mode 100644 index 00000000..cb9fe45a --- /dev/null +++ b/experiments/out-1-withbarchart/docProps/core.xml @@ -0,0 +1,2 @@ + +Sample PPTX DocumentofficegenVo Thanh Loc22013-12-30T17:19:02Z2014-01-10T07:55:04Z \ No newline at end of file diff --git a/experiments/out-1-withbarchart/ppt/_rels/presentation.xml.rels b/experiments/out-1-withbarchart/ppt/_rels/presentation.xml.rels new file mode 100644 index 00000000..26f24cb3 --- /dev/null +++ b/experiments/out-1-withbarchart/ppt/_rels/presentation.xml.rels @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withbarchart/ppt/charts/_rels/chart1.xml.rels b/experiments/out-1-withbarchart/ppt/charts/_rels/chart1.xml.rels new file mode 100644 index 00000000..35ab5d21 --- /dev/null +++ b/experiments/out-1-withbarchart/ppt/charts/_rels/chart1.xml.rels @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withbarchart/ppt/charts/chart1.xml b/experiments/out-1-withbarchart/ppt/charts/chart1.xml new file mode 100644 index 00000000..785bef0d --- /dev/null +++ b/experiments/out-1-withbarchart/ppt/charts/chart1.xml @@ -0,0 +1,2 @@ + +Sheet1!$B$1Series 1Sheet1!$A$2:$A$5Category 1Category 2Category 3Category 4Sheet1!$B$2:$B$5General4.32.53.54.5Sheet1!$C$1Series 2Sheet1!$A$2:$A$5Category 1Category 2Category 3Category 4Sheet1!$C$2:$C$5General2.44.40000000000000041.82.8Sheet1!$D$1Series 3Sheet1!$A$2:$A$5Category 1Category 2Category 3Category 4Sheet1!$D$2:$D$5General2235 \ No newline at end of file diff --git a/experiments/out-1-withbarchart/ppt/charts/colors1.xml b/experiments/out-1-withbarchart/ppt/charts/colors1.xml new file mode 100644 index 00000000..690f59e6 --- /dev/null +++ b/experiments/out-1-withbarchart/ppt/charts/colors1.xml @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/experiments/out-1-withbarchart/ppt/charts/style1.xml b/experiments/out-1-withbarchart/ppt/charts/style1.xml new file mode 100644 index 00000000..9f504fb8 --- /dev/null +++ b/experiments/out-1-withbarchart/ppt/charts/style1.xml @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/experiments/out-1-withbarchart/ppt/embeddings/Microsoft_Excel_Worksheet1.xlsx b/experiments/out-1-withbarchart/ppt/embeddings/Microsoft_Excel_Worksheet1.xlsx new file mode 100644 index 00000000..4987c519 Binary files /dev/null and b/experiments/out-1-withbarchart/ppt/embeddings/Microsoft_Excel_Worksheet1.xlsx differ diff --git a/experiments/out-1-withbarchart/ppt/media/image1.png b/experiments/out-1-withbarchart/ppt/media/image1.png new file mode 100644 index 00000000..ddcbf8ce Binary files /dev/null and b/experiments/out-1-withbarchart/ppt/media/image1.png differ diff --git a/experiments/out-1-withbarchart/ppt/media/image2.jpeg b/experiments/out-1-withbarchart/ppt/media/image2.jpeg new file mode 100644 index 00000000..7e96fe6a Binary files /dev/null and b/experiments/out-1-withbarchart/ppt/media/image2.jpeg differ diff --git a/experiments/out-1-withbarchart/ppt/media/image3.png b/experiments/out-1-withbarchart/ppt/media/image3.png new file mode 100644 index 00000000..557096ea Binary files /dev/null and b/experiments/out-1-withbarchart/ppt/media/image3.png differ diff --git a/experiments/out-1-withbarchart/ppt/media/image4.png b/experiments/out-1-withbarchart/ppt/media/image4.png new file mode 100644 index 00000000..f6124ad7 Binary files /dev/null and b/experiments/out-1-withbarchart/ppt/media/image4.png differ diff --git a/experiments/out-1-withbarchart/ppt/media/image5.png b/experiments/out-1-withbarchart/ppt/media/image5.png new file mode 100644 index 00000000..34ca2bd8 Binary files /dev/null and b/experiments/out-1-withbarchart/ppt/media/image5.png differ diff --git a/experiments/out-1-withbarchart/ppt/media/image6.png b/experiments/out-1-withbarchart/ppt/media/image6.png new file mode 100644 index 00000000..7ffffa3b Binary files /dev/null and b/experiments/out-1-withbarchart/ppt/media/image6.png differ diff --git a/experiments/out-1-withbarchart/ppt/media/image7.png b/experiments/out-1-withbarchart/ppt/media/image7.png new file mode 100644 index 00000000..1b9cc19f Binary files /dev/null and b/experiments/out-1-withbarchart/ppt/media/image7.png differ diff --git a/experiments/out-1-withbarchart/ppt/presProps.xml b/experiments/out-1-withbarchart/ppt/presProps.xml new file mode 100644 index 00000000..501bd048 --- /dev/null +++ b/experiments/out-1-withbarchart/ppt/presProps.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withbarchart/ppt/presentation.xml b/experiments/out-1-withbarchart/ppt/presentation.xml new file mode 100644 index 00000000..ef5863bb --- /dev/null +++ b/experiments/out-1-withbarchart/ppt/presentation.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withbarchart/ppt/slideLayouts/_rels/slideLayout1.xml.rels b/experiments/out-1-withbarchart/ppt/slideLayouts/_rels/slideLayout1.xml.rels new file mode 100644 index 00000000..69d8ac58 --- /dev/null +++ b/experiments/out-1-withbarchart/ppt/slideLayouts/_rels/slideLayout1.xml.rels @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withbarchart/ppt/slideLayouts/slideLayout1.xml b/experiments/out-1-withbarchart/ppt/slideLayouts/slideLayout1.xml new file mode 100644 index 00000000..558ee550 --- /dev/null +++ b/experiments/out-1-withbarchart/ppt/slideLayouts/slideLayout1.xml @@ -0,0 +1,2 @@ + +Click to edit Master title styleClick to edit Master subtitle style1/10/2014‹#› \ No newline at end of file diff --git a/experiments/out-1-withbarchart/ppt/slideMasters/_rels/slideMaster1.xml.rels b/experiments/out-1-withbarchart/ppt/slideMasters/_rels/slideMaster1.xml.rels new file mode 100644 index 00000000..40bf0c97 --- /dev/null +++ b/experiments/out-1-withbarchart/ppt/slideMasters/_rels/slideMaster1.xml.rels @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withbarchart/ppt/slideMasters/slideMaster1.xml b/experiments/out-1-withbarchart/ppt/slideMasters/slideMaster1.xml new file mode 100644 index 00000000..611d8471 --- /dev/null +++ b/experiments/out-1-withbarchart/ppt/slideMasters/slideMaster1.xml @@ -0,0 +1,2 @@ + +Click to edit Master title styleClick to edit Master text stylesSecond levelThird levelFourth levelFifth level1/10/2014‹#› \ No newline at end of file diff --git a/experiments/out-1-withbarchart/ppt/slides/_rels/slide1.xml.rels b/experiments/out-1-withbarchart/ppt/slides/_rels/slide1.xml.rels new file mode 100644 index 00000000..aca39d53 --- /dev/null +++ b/experiments/out-1-withbarchart/ppt/slides/_rels/slide1.xml.rels @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withbarchart/ppt/slides/_rels/slide10.xml.rels b/experiments/out-1-withbarchart/ppt/slides/_rels/slide10.xml.rels new file mode 100644 index 00000000..471fc073 --- /dev/null +++ b/experiments/out-1-withbarchart/ppt/slides/_rels/slide10.xml.rels @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withbarchart/ppt/slides/_rels/slide2.xml.rels b/experiments/out-1-withbarchart/ppt/slides/_rels/slide2.xml.rels new file mode 100644 index 00000000..593c255e --- /dev/null +++ b/experiments/out-1-withbarchart/ppt/slides/_rels/slide2.xml.rels @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withbarchart/ppt/slides/_rels/slide3.xml.rels b/experiments/out-1-withbarchart/ppt/slides/_rels/slide3.xml.rels new file mode 100644 index 00000000..593c255e --- /dev/null +++ b/experiments/out-1-withbarchart/ppt/slides/_rels/slide3.xml.rels @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withbarchart/ppt/slides/_rels/slide4.xml.rels b/experiments/out-1-withbarchart/ppt/slides/_rels/slide4.xml.rels new file mode 100644 index 00000000..593c255e --- /dev/null +++ b/experiments/out-1-withbarchart/ppt/slides/_rels/slide4.xml.rels @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withbarchart/ppt/slides/_rels/slide5.xml.rels b/experiments/out-1-withbarchart/ppt/slides/_rels/slide5.xml.rels new file mode 100644 index 00000000..06c5caa0 --- /dev/null +++ b/experiments/out-1-withbarchart/ppt/slides/_rels/slide5.xml.rels @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withbarchart/ppt/slides/_rels/slide6.xml.rels b/experiments/out-1-withbarchart/ppt/slides/_rels/slide6.xml.rels new file mode 100644 index 00000000..0ba455cf --- /dev/null +++ b/experiments/out-1-withbarchart/ppt/slides/_rels/slide6.xml.rels @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withbarchart/ppt/slides/_rels/slide7.xml.rels b/experiments/out-1-withbarchart/ppt/slides/_rels/slide7.xml.rels new file mode 100644 index 00000000..baeadab9 --- /dev/null +++ b/experiments/out-1-withbarchart/ppt/slides/_rels/slide7.xml.rels @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withbarchart/ppt/slides/_rels/slide8.xml.rels b/experiments/out-1-withbarchart/ppt/slides/_rels/slide8.xml.rels new file mode 100644 index 00000000..0ba455cf --- /dev/null +++ b/experiments/out-1-withbarchart/ppt/slides/_rels/slide8.xml.rels @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withbarchart/ppt/slides/_rels/slide9.xml.rels b/experiments/out-1-withbarchart/ppt/slides/_rels/slide9.xml.rels new file mode 100644 index 00000000..65b3775a --- /dev/null +++ b/experiments/out-1-withbarchart/ppt/slides/_rels/slide9.xml.rels @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withbarchart/ppt/slides/slide1.xml b/experiments/out-1-withbarchart/ppt/slides/slide1.xml new file mode 100644 index 00000000..fd9e0ac1 --- /dev/null +++ b/experiments/out-1-withbarchart/ppt/slides/slide1.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withbarchart/ppt/slides/slide10.xml b/experiments/out-1-withbarchart/ppt/slides/slide10.xml new file mode 100644 index 00000000..5ab4c3ce --- /dev/null +++ b/experiments/out-1-withbarchart/ppt/slides/slide10.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withbarchart/ppt/slides/slide2.xml b/experiments/out-1-withbarchart/ppt/slides/slide2.xml new file mode 100644 index 00000000..ee72ae92 --- /dev/null +++ b/experiments/out-1-withbarchart/ppt/slides/slide2.xml @@ -0,0 +1,2 @@ + +Created using Officegen version 0.2.6Fast positionFull lineHello World!Office generatorBoomBoom!!! \ No newline at end of file diff --git a/experiments/out-1-withbarchart/ppt/slides/slide3.xml b/experiments/out-1-withbarchart/ppt/slides/slide3.xml new file mode 100644 index 00000000..b8a1ba59 --- /dev/null +++ b/experiments/out-1-withbarchart/ppt/slides/slide3.xml @@ -0,0 +1,2 @@ + +Office generator \ No newline at end of file diff --git a/experiments/out-1-withbarchart/ppt/slides/slide4.xml b/experiments/out-1-withbarchart/ppt/slides/slide4.xml new file mode 100644 index 00000000..acc4285d --- /dev/null +++ b/experiments/out-1-withbarchart/ppt/slides/slide4.xml @@ -0,0 +1,2 @@ + +Red lineRed box 1Red box 2 \ No newline at end of file diff --git a/experiments/out-1-withbarchart/ppt/slides/slide5.xml b/experiments/out-1-withbarchart/ppt/slides/slide5.xml new file mode 100644 index 00000000..74c996e7 --- /dev/null +++ b/experiments/out-1-withbarchart/ppt/slides/slide5.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withbarchart/ppt/slides/slide6.xml b/experiments/out-1-withbarchart/ppt/slides/slide6.xml new file mode 100644 index 00000000..8d505524 --- /dev/null +++ b/experiments/out-1-withbarchart/ppt/slides/slide6.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withbarchart/ppt/slides/slide7.xml b/experiments/out-1-withbarchart/ppt/slides/slide7.xml new file mode 100644 index 00000000..ad3fe1e8 --- /dev/null +++ b/experiments/out-1-withbarchart/ppt/slides/slide7.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withbarchart/ppt/slides/slide8.xml b/experiments/out-1-withbarchart/ppt/slides/slide8.xml new file mode 100644 index 00000000..8d505524 --- /dev/null +++ b/experiments/out-1-withbarchart/ppt/slides/slide8.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withbarchart/ppt/slides/slide9.xml b/experiments/out-1-withbarchart/ppt/slides/slide9.xml new file mode 100644 index 00000000..44db8ba4 --- /dev/null +++ b/experiments/out-1-withbarchart/ppt/slides/slide9.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withbarchart/ppt/tableStyles.xml b/experiments/out-1-withbarchart/ppt/tableStyles.xml new file mode 100644 index 00000000..0dd0dff2 --- /dev/null +++ b/experiments/out-1-withbarchart/ppt/tableStyles.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withbarchart/ppt/theme/theme1.xml b/experiments/out-1-withbarchart/ppt/theme/theme1.xml new file mode 100644 index 00000000..ee953eb6 --- /dev/null +++ b/experiments/out-1-withbarchart/ppt/theme/theme1.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withbarchart/ppt/viewProps.xml b/experiments/out-1-withbarchart/ppt/viewProps.xml new file mode 100644 index 00000000..af60f095 --- /dev/null +++ b/experiments/out-1-withbarchart/ppt/viewProps.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withchart/[Content_Types].xml b/experiments/out-1-withchart/[Content_Types].xml new file mode 100644 index 00000000..96fb4996 --- /dev/null +++ b/experiments/out-1-withchart/[Content_Types].xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withchart/_rels/.rels b/experiments/out-1-withchart/_rels/.rels new file mode 100644 index 00000000..80812298 --- /dev/null +++ b/experiments/out-1-withchart/_rels/.rels @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withchart/docProps/app.xml b/experiments/out-1-withchart/docProps/app.xml new file mode 100644 index 00000000..b1f8a5c8 --- /dev/null +++ b/experiments/out-1-withchart/docProps/app.xml @@ -0,0 +1,2 @@ + +1329Microsoft Office PowerPointOn-screen Show (4:3)1210010falseFonts Used3Theme1Slide Titles10ArialCalibriWide LatinOffice ThemePowerPoint PresentationPowerPoint PresentationPowerPoint PresentationPowerPoint PresentationPowerPoint PresentationPowerPoint PresentationPowerPoint PresentationPowerPoint PresentationPowerPoint PresentationPowerPoint Presentationofficegenfalsefalsefalse15.0000 \ No newline at end of file diff --git a/experiments/out-1-withchart/docProps/core.xml b/experiments/out-1-withchart/docProps/core.xml new file mode 100644 index 00000000..c0096cd6 --- /dev/null +++ b/experiments/out-1-withchart/docProps/core.xml @@ -0,0 +1,2 @@ + +Sample PPTX DocumentofficegenVo Thanh Loc22013-12-30T17:19:02Z2013-12-30T10:33:26Z \ No newline at end of file diff --git a/experiments/out-1-withchart/ppt/_rels/presentation.xml.rels b/experiments/out-1-withchart/ppt/_rels/presentation.xml.rels new file mode 100644 index 00000000..26f24cb3 --- /dev/null +++ b/experiments/out-1-withchart/ppt/_rels/presentation.xml.rels @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withchart/ppt/charts/_rels/chart1.xml.rels b/experiments/out-1-withchart/ppt/charts/_rels/chart1.xml.rels new file mode 100644 index 00000000..35ab5d21 --- /dev/null +++ b/experiments/out-1-withchart/ppt/charts/_rels/chart1.xml.rels @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withchart/ppt/charts/chart1.xml b/experiments/out-1-withchart/ppt/charts/chart1.xml new file mode 100644 index 00000000..2b7fd774 --- /dev/null +++ b/experiments/out-1-withchart/ppt/charts/chart1.xml @@ -0,0 +1,2 @@ + +Sheet1!$B$1Series 1Sheet1!$A$2:$A$5Category 1Category 2Category 3Category 4Sheet1!$B$2:$B$5General4.32.53.54.5Sheet1!$C$1Series 2Sheet1!$A$2:$A$5Category 1Category 2Category 3Category 4Sheet1!$C$2:$C$5General2.44.40000000000000041.82.8Sheet1!$D$1Series 3Sheet1!$A$2:$A$5Category 1Category 2Category 3Category 4Sheet1!$D$2:$D$5General2235 \ No newline at end of file diff --git a/experiments/out-1-withchart/ppt/charts/colors1.xml b/experiments/out-1-withchart/ppt/charts/colors1.xml new file mode 100644 index 00000000..690f59e6 --- /dev/null +++ b/experiments/out-1-withchart/ppt/charts/colors1.xml @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/experiments/out-1-withchart/ppt/charts/style1.xml b/experiments/out-1-withchart/ppt/charts/style1.xml new file mode 100644 index 00000000..0f9def69 --- /dev/null +++ b/experiments/out-1-withchart/ppt/charts/style1.xml @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/experiments/out-1-withchart/ppt/embeddings/Microsoft_Excel_Worksheet1.xlsx b/experiments/out-1-withchart/ppt/embeddings/Microsoft_Excel_Worksheet1.xlsx new file mode 100644 index 00000000..fcd5bded Binary files /dev/null and b/experiments/out-1-withchart/ppt/embeddings/Microsoft_Excel_Worksheet1.xlsx differ diff --git a/experiments/out-1-withchart/ppt/media/image1.png b/experiments/out-1-withchart/ppt/media/image1.png new file mode 100644 index 00000000..ddcbf8ce Binary files /dev/null and b/experiments/out-1-withchart/ppt/media/image1.png differ diff --git a/experiments/out-1-withchart/ppt/media/image2.jpeg b/experiments/out-1-withchart/ppt/media/image2.jpeg new file mode 100644 index 00000000..7e96fe6a Binary files /dev/null and b/experiments/out-1-withchart/ppt/media/image2.jpeg differ diff --git a/experiments/out-1-withchart/ppt/media/image3.png b/experiments/out-1-withchart/ppt/media/image3.png new file mode 100644 index 00000000..557096ea Binary files /dev/null and b/experiments/out-1-withchart/ppt/media/image3.png differ diff --git a/experiments/out-1-withchart/ppt/media/image4.png b/experiments/out-1-withchart/ppt/media/image4.png new file mode 100644 index 00000000..f6124ad7 Binary files /dev/null and b/experiments/out-1-withchart/ppt/media/image4.png differ diff --git a/experiments/out-1-withchart/ppt/media/image5.png b/experiments/out-1-withchart/ppt/media/image5.png new file mode 100644 index 00000000..34ca2bd8 Binary files /dev/null and b/experiments/out-1-withchart/ppt/media/image5.png differ diff --git a/experiments/out-1-withchart/ppt/media/image6.png b/experiments/out-1-withchart/ppt/media/image6.png new file mode 100644 index 00000000..7ffffa3b Binary files /dev/null and b/experiments/out-1-withchart/ppt/media/image6.png differ diff --git a/experiments/out-1-withchart/ppt/media/image7.png b/experiments/out-1-withchart/ppt/media/image7.png new file mode 100644 index 00000000..1b9cc19f Binary files /dev/null and b/experiments/out-1-withchart/ppt/media/image7.png differ diff --git a/experiments/out-1-withchart/ppt/presProps.xml b/experiments/out-1-withchart/ppt/presProps.xml new file mode 100644 index 00000000..501bd048 --- /dev/null +++ b/experiments/out-1-withchart/ppt/presProps.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withchart/ppt/presentation.xml b/experiments/out-1-withchart/ppt/presentation.xml new file mode 100644 index 00000000..ef5863bb --- /dev/null +++ b/experiments/out-1-withchart/ppt/presentation.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withchart/ppt/slideLayouts/_rels/slideLayout1.xml.rels b/experiments/out-1-withchart/ppt/slideLayouts/_rels/slideLayout1.xml.rels new file mode 100644 index 00000000..69d8ac58 --- /dev/null +++ b/experiments/out-1-withchart/ppt/slideLayouts/_rels/slideLayout1.xml.rels @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withchart/ppt/slideLayouts/slideLayout1.xml b/experiments/out-1-withchart/ppt/slideLayouts/slideLayout1.xml new file mode 100644 index 00000000..9db54a89 --- /dev/null +++ b/experiments/out-1-withchart/ppt/slideLayouts/slideLayout1.xml @@ -0,0 +1,2 @@ + +Click to edit Master title styleClick to edit Master subtitle style12/30/2013‹#› \ No newline at end of file diff --git a/experiments/out-1-withchart/ppt/slideMasters/_rels/slideMaster1.xml.rels b/experiments/out-1-withchart/ppt/slideMasters/_rels/slideMaster1.xml.rels new file mode 100644 index 00000000..40bf0c97 --- /dev/null +++ b/experiments/out-1-withchart/ppt/slideMasters/_rels/slideMaster1.xml.rels @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withchart/ppt/slideMasters/slideMaster1.xml b/experiments/out-1-withchart/ppt/slideMasters/slideMaster1.xml new file mode 100644 index 00000000..415f756d --- /dev/null +++ b/experiments/out-1-withchart/ppt/slideMasters/slideMaster1.xml @@ -0,0 +1,2 @@ + +Click to edit Master title styleClick to edit Master text stylesSecond levelThird levelFourth levelFifth level12/30/2013‹#› \ No newline at end of file diff --git a/experiments/out-1-withchart/ppt/slides/_rels/slide1.xml.rels b/experiments/out-1-withchart/ppt/slides/_rels/slide1.xml.rels new file mode 100644 index 00000000..aca39d53 --- /dev/null +++ b/experiments/out-1-withchart/ppt/slides/_rels/slide1.xml.rels @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withchart/ppt/slides/_rels/slide10.xml.rels b/experiments/out-1-withchart/ppt/slides/_rels/slide10.xml.rels new file mode 100644 index 00000000..471fc073 --- /dev/null +++ b/experiments/out-1-withchart/ppt/slides/_rels/slide10.xml.rels @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withchart/ppt/slides/_rels/slide2.xml.rels b/experiments/out-1-withchart/ppt/slides/_rels/slide2.xml.rels new file mode 100644 index 00000000..593c255e --- /dev/null +++ b/experiments/out-1-withchart/ppt/slides/_rels/slide2.xml.rels @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withchart/ppt/slides/_rels/slide3.xml.rels b/experiments/out-1-withchart/ppt/slides/_rels/slide3.xml.rels new file mode 100644 index 00000000..593c255e --- /dev/null +++ b/experiments/out-1-withchart/ppt/slides/_rels/slide3.xml.rels @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withchart/ppt/slides/_rels/slide4.xml.rels b/experiments/out-1-withchart/ppt/slides/_rels/slide4.xml.rels new file mode 100644 index 00000000..593c255e --- /dev/null +++ b/experiments/out-1-withchart/ppt/slides/_rels/slide4.xml.rels @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withchart/ppt/slides/_rels/slide5.xml.rels b/experiments/out-1-withchart/ppt/slides/_rels/slide5.xml.rels new file mode 100644 index 00000000..06c5caa0 --- /dev/null +++ b/experiments/out-1-withchart/ppt/slides/_rels/slide5.xml.rels @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withchart/ppt/slides/_rels/slide6.xml.rels b/experiments/out-1-withchart/ppt/slides/_rels/slide6.xml.rels new file mode 100644 index 00000000..0ba455cf --- /dev/null +++ b/experiments/out-1-withchart/ppt/slides/_rels/slide6.xml.rels @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withchart/ppt/slides/_rels/slide7.xml.rels b/experiments/out-1-withchart/ppt/slides/_rels/slide7.xml.rels new file mode 100644 index 00000000..baeadab9 --- /dev/null +++ b/experiments/out-1-withchart/ppt/slides/_rels/slide7.xml.rels @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withchart/ppt/slides/_rels/slide8.xml.rels b/experiments/out-1-withchart/ppt/slides/_rels/slide8.xml.rels new file mode 100644 index 00000000..0ba455cf --- /dev/null +++ b/experiments/out-1-withchart/ppt/slides/_rels/slide8.xml.rels @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withchart/ppt/slides/_rels/slide9.xml.rels b/experiments/out-1-withchart/ppt/slides/_rels/slide9.xml.rels new file mode 100644 index 00000000..65b3775a --- /dev/null +++ b/experiments/out-1-withchart/ppt/slides/_rels/slide9.xml.rels @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withchart/ppt/slides/slide1.xml b/experiments/out-1-withchart/ppt/slides/slide1.xml new file mode 100644 index 00000000..eb238acf --- /dev/null +++ b/experiments/out-1-withchart/ppt/slides/slide1.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withchart/ppt/slides/slide10.xml b/experiments/out-1-withchart/ppt/slides/slide10.xml new file mode 100644 index 00000000..5ab4c3ce --- /dev/null +++ b/experiments/out-1-withchart/ppt/slides/slide10.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withchart/ppt/slides/slide2.xml b/experiments/out-1-withchart/ppt/slides/slide2.xml new file mode 100644 index 00000000..ee72ae92 --- /dev/null +++ b/experiments/out-1-withchart/ppt/slides/slide2.xml @@ -0,0 +1,2 @@ + +Created using Officegen version 0.2.6Fast positionFull lineHello World!Office generatorBoomBoom!!! \ No newline at end of file diff --git a/experiments/out-1-withchart/ppt/slides/slide3.xml b/experiments/out-1-withchart/ppt/slides/slide3.xml new file mode 100644 index 00000000..b8a1ba59 --- /dev/null +++ b/experiments/out-1-withchart/ppt/slides/slide3.xml @@ -0,0 +1,2 @@ + +Office generator \ No newline at end of file diff --git a/experiments/out-1-withchart/ppt/slides/slide4.xml b/experiments/out-1-withchart/ppt/slides/slide4.xml new file mode 100644 index 00000000..acc4285d --- /dev/null +++ b/experiments/out-1-withchart/ppt/slides/slide4.xml @@ -0,0 +1,2 @@ + +Red lineRed box 1Red box 2 \ No newline at end of file diff --git a/experiments/out-1-withchart/ppt/slides/slide5.xml b/experiments/out-1-withchart/ppt/slides/slide5.xml new file mode 100644 index 00000000..74c996e7 --- /dev/null +++ b/experiments/out-1-withchart/ppt/slides/slide5.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withchart/ppt/slides/slide6.xml b/experiments/out-1-withchart/ppt/slides/slide6.xml new file mode 100644 index 00000000..8d505524 --- /dev/null +++ b/experiments/out-1-withchart/ppt/slides/slide6.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withchart/ppt/slides/slide7.xml b/experiments/out-1-withchart/ppt/slides/slide7.xml new file mode 100644 index 00000000..ad3fe1e8 --- /dev/null +++ b/experiments/out-1-withchart/ppt/slides/slide7.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withchart/ppt/slides/slide8.xml b/experiments/out-1-withchart/ppt/slides/slide8.xml new file mode 100644 index 00000000..8d505524 --- /dev/null +++ b/experiments/out-1-withchart/ppt/slides/slide8.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withchart/ppt/slides/slide9.xml b/experiments/out-1-withchart/ppt/slides/slide9.xml new file mode 100644 index 00000000..44db8ba4 --- /dev/null +++ b/experiments/out-1-withchart/ppt/slides/slide9.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withchart/ppt/tableStyles.xml b/experiments/out-1-withchart/ppt/tableStyles.xml new file mode 100644 index 00000000..0dd0dff2 --- /dev/null +++ b/experiments/out-1-withchart/ppt/tableStyles.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withchart/ppt/theme/theme1.xml b/experiments/out-1-withchart/ppt/theme/theme1.xml new file mode 100644 index 00000000..ee953eb6 --- /dev/null +++ b/experiments/out-1-withchart/ppt/theme/theme1.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withchart/ppt/viewProps.xml b/experiments/out-1-withchart/ppt/viewProps.xml new file mode 100644 index 00000000..af60f095 --- /dev/null +++ b/experiments/out-1-withchart/ppt/viewProps.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withpiechart.pptx b/experiments/out-1-withpiechart.pptx new file mode 100644 index 00000000..32cdf1fe Binary files /dev/null and b/experiments/out-1-withpiechart.pptx differ diff --git a/experiments/out-1-withpiechart/[Content_Types].xml b/experiments/out-1-withpiechart/[Content_Types].xml new file mode 100644 index 00000000..96fb4996 --- /dev/null +++ b/experiments/out-1-withpiechart/[Content_Types].xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withpiechart/_rels/.rels b/experiments/out-1-withpiechart/_rels/.rels new file mode 100644 index 00000000..80812298 --- /dev/null +++ b/experiments/out-1-withpiechart/_rels/.rels @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withpiechart/docProps/app.xml b/experiments/out-1-withpiechart/docProps/app.xml new file mode 100644 index 00000000..f19d83d4 --- /dev/null +++ b/experiments/out-1-withpiechart/docProps/app.xml @@ -0,0 +1,2 @@ + +1629Microsoft Office PowerPointOn-screen Show (4:3)1210010falseFonts Used3Theme1Slide Titles10ArialCalibriWide LatinOffice ThemePowerPoint PresentationPowerPoint PresentationPowerPoint PresentationPowerPoint PresentationPowerPoint PresentationPowerPoint PresentationPowerPoint PresentationPowerPoint PresentationPowerPoint PresentationPowerPoint Presentationofficegenfalsefalsefalse15.0000 \ No newline at end of file diff --git a/experiments/out-1-withpiechart/docProps/core.xml b/experiments/out-1-withpiechart/docProps/core.xml new file mode 100644 index 00000000..d193a845 --- /dev/null +++ b/experiments/out-1-withpiechart/docProps/core.xml @@ -0,0 +1,2 @@ + +Sample PPTX DocumentofficegenVo Thanh Loc22013-12-30T17:19:02Z2014-01-09T10:18:30Z \ No newline at end of file diff --git a/experiments/out-1-withpiechart/ppt/_rels/presentation.xml.rels b/experiments/out-1-withpiechart/ppt/_rels/presentation.xml.rels new file mode 100644 index 00000000..26f24cb3 --- /dev/null +++ b/experiments/out-1-withpiechart/ppt/_rels/presentation.xml.rels @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withpiechart/ppt/charts/_rels/chart1.xml.rels b/experiments/out-1-withpiechart/ppt/charts/_rels/chart1.xml.rels new file mode 100644 index 00000000..35ab5d21 --- /dev/null +++ b/experiments/out-1-withpiechart/ppt/charts/_rels/chart1.xml.rels @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withpiechart/ppt/charts/chart1.xml b/experiments/out-1-withpiechart/ppt/charts/chart1.xml new file mode 100644 index 00000000..decf9b46 --- /dev/null +++ b/experiments/out-1-withpiechart/ppt/charts/chart1.xml @@ -0,0 +1,2 @@ + +Sheet1!$B$1Oil productionSheet1!$A$2:$A$8Czech RepublicIrelandGermanyAustraliaAustriaUKBelgiumSheet1!$B$2:$B$8General301.89999999999998201.1165.8139.9128.300000000000019999 \ No newline at end of file diff --git a/experiments/out-1-withpiechart/ppt/charts/colors1.xml b/experiments/out-1-withpiechart/ppt/charts/colors1.xml new file mode 100644 index 00000000..690f59e6 --- /dev/null +++ b/experiments/out-1-withpiechart/ppt/charts/colors1.xml @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/experiments/out-1-withpiechart/ppt/charts/style1.xml b/experiments/out-1-withpiechart/ppt/charts/style1.xml new file mode 100644 index 00000000..3ec7fb1e --- /dev/null +++ b/experiments/out-1-withpiechart/ppt/charts/style1.xml @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/experiments/out-1-withpiechart/ppt/embeddings/Microsoft_Excel_Worksheet1.xlsx b/experiments/out-1-withpiechart/ppt/embeddings/Microsoft_Excel_Worksheet1.xlsx new file mode 100644 index 00000000..f68fdbff Binary files /dev/null and b/experiments/out-1-withpiechart/ppt/embeddings/Microsoft_Excel_Worksheet1.xlsx differ diff --git a/experiments/out-1-withpiechart/ppt/media/image1.png b/experiments/out-1-withpiechart/ppt/media/image1.png new file mode 100644 index 00000000..ddcbf8ce Binary files /dev/null and b/experiments/out-1-withpiechart/ppt/media/image1.png differ diff --git a/experiments/out-1-withpiechart/ppt/media/image2.jpeg b/experiments/out-1-withpiechart/ppt/media/image2.jpeg new file mode 100644 index 00000000..7e96fe6a Binary files /dev/null and b/experiments/out-1-withpiechart/ppt/media/image2.jpeg differ diff --git a/experiments/out-1-withpiechart/ppt/media/image3.png b/experiments/out-1-withpiechart/ppt/media/image3.png new file mode 100644 index 00000000..557096ea Binary files /dev/null and b/experiments/out-1-withpiechart/ppt/media/image3.png differ diff --git a/experiments/out-1-withpiechart/ppt/media/image4.png b/experiments/out-1-withpiechart/ppt/media/image4.png new file mode 100644 index 00000000..f6124ad7 Binary files /dev/null and b/experiments/out-1-withpiechart/ppt/media/image4.png differ diff --git a/experiments/out-1-withpiechart/ppt/media/image5.png b/experiments/out-1-withpiechart/ppt/media/image5.png new file mode 100644 index 00000000..34ca2bd8 Binary files /dev/null and b/experiments/out-1-withpiechart/ppt/media/image5.png differ diff --git a/experiments/out-1-withpiechart/ppt/media/image6.png b/experiments/out-1-withpiechart/ppt/media/image6.png new file mode 100644 index 00000000..7ffffa3b Binary files /dev/null and b/experiments/out-1-withpiechart/ppt/media/image6.png differ diff --git a/experiments/out-1-withpiechart/ppt/media/image7.png b/experiments/out-1-withpiechart/ppt/media/image7.png new file mode 100644 index 00000000..1b9cc19f Binary files /dev/null and b/experiments/out-1-withpiechart/ppt/media/image7.png differ diff --git a/experiments/out-1-withpiechart/ppt/presProps.xml b/experiments/out-1-withpiechart/ppt/presProps.xml new file mode 100644 index 00000000..501bd048 --- /dev/null +++ b/experiments/out-1-withpiechart/ppt/presProps.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withpiechart/ppt/presentation.xml b/experiments/out-1-withpiechart/ppt/presentation.xml new file mode 100644 index 00000000..ef5863bb --- /dev/null +++ b/experiments/out-1-withpiechart/ppt/presentation.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withpiechart/ppt/slideLayouts/_rels/slideLayout1.xml.rels b/experiments/out-1-withpiechart/ppt/slideLayouts/_rels/slideLayout1.xml.rels new file mode 100644 index 00000000..69d8ac58 --- /dev/null +++ b/experiments/out-1-withpiechart/ppt/slideLayouts/_rels/slideLayout1.xml.rels @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withpiechart/ppt/slideLayouts/slideLayout1.xml b/experiments/out-1-withpiechart/ppt/slideLayouts/slideLayout1.xml new file mode 100644 index 00000000..15aeff9b --- /dev/null +++ b/experiments/out-1-withpiechart/ppt/slideLayouts/slideLayout1.xml @@ -0,0 +1,2 @@ + +Click to edit Master title styleClick to edit Master subtitle style1/9/2014‹#› \ No newline at end of file diff --git a/experiments/out-1-withpiechart/ppt/slideMasters/_rels/slideMaster1.xml.rels b/experiments/out-1-withpiechart/ppt/slideMasters/_rels/slideMaster1.xml.rels new file mode 100644 index 00000000..40bf0c97 --- /dev/null +++ b/experiments/out-1-withpiechart/ppt/slideMasters/_rels/slideMaster1.xml.rels @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withpiechart/ppt/slideMasters/slideMaster1.xml b/experiments/out-1-withpiechart/ppt/slideMasters/slideMaster1.xml new file mode 100644 index 00000000..145b4165 --- /dev/null +++ b/experiments/out-1-withpiechart/ppt/slideMasters/slideMaster1.xml @@ -0,0 +1,2 @@ + +Click to edit Master title styleClick to edit Master text stylesSecond levelThird levelFourth levelFifth level1/9/2014‹#› \ No newline at end of file diff --git a/experiments/out-1-withpiechart/ppt/slides/_rels/slide1.xml.rels b/experiments/out-1-withpiechart/ppt/slides/_rels/slide1.xml.rels new file mode 100644 index 00000000..aca39d53 --- /dev/null +++ b/experiments/out-1-withpiechart/ppt/slides/_rels/slide1.xml.rels @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withpiechart/ppt/slides/_rels/slide10.xml.rels b/experiments/out-1-withpiechart/ppt/slides/_rels/slide10.xml.rels new file mode 100644 index 00000000..471fc073 --- /dev/null +++ b/experiments/out-1-withpiechart/ppt/slides/_rels/slide10.xml.rels @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withpiechart/ppt/slides/_rels/slide2.xml.rels b/experiments/out-1-withpiechart/ppt/slides/_rels/slide2.xml.rels new file mode 100644 index 00000000..593c255e --- /dev/null +++ b/experiments/out-1-withpiechart/ppt/slides/_rels/slide2.xml.rels @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withpiechart/ppt/slides/_rels/slide3.xml.rels b/experiments/out-1-withpiechart/ppt/slides/_rels/slide3.xml.rels new file mode 100644 index 00000000..593c255e --- /dev/null +++ b/experiments/out-1-withpiechart/ppt/slides/_rels/slide3.xml.rels @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withpiechart/ppt/slides/_rels/slide4.xml.rels b/experiments/out-1-withpiechart/ppt/slides/_rels/slide4.xml.rels new file mode 100644 index 00000000..593c255e --- /dev/null +++ b/experiments/out-1-withpiechart/ppt/slides/_rels/slide4.xml.rels @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withpiechart/ppt/slides/_rels/slide5.xml.rels b/experiments/out-1-withpiechart/ppt/slides/_rels/slide5.xml.rels new file mode 100644 index 00000000..06c5caa0 --- /dev/null +++ b/experiments/out-1-withpiechart/ppt/slides/_rels/slide5.xml.rels @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withpiechart/ppt/slides/_rels/slide6.xml.rels b/experiments/out-1-withpiechart/ppt/slides/_rels/slide6.xml.rels new file mode 100644 index 00000000..0ba455cf --- /dev/null +++ b/experiments/out-1-withpiechart/ppt/slides/_rels/slide6.xml.rels @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withpiechart/ppt/slides/_rels/slide7.xml.rels b/experiments/out-1-withpiechart/ppt/slides/_rels/slide7.xml.rels new file mode 100644 index 00000000..baeadab9 --- /dev/null +++ b/experiments/out-1-withpiechart/ppt/slides/_rels/slide7.xml.rels @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withpiechart/ppt/slides/_rels/slide8.xml.rels b/experiments/out-1-withpiechart/ppt/slides/_rels/slide8.xml.rels new file mode 100644 index 00000000..0ba455cf --- /dev/null +++ b/experiments/out-1-withpiechart/ppt/slides/_rels/slide8.xml.rels @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withpiechart/ppt/slides/_rels/slide9.xml.rels b/experiments/out-1-withpiechart/ppt/slides/_rels/slide9.xml.rels new file mode 100644 index 00000000..65b3775a --- /dev/null +++ b/experiments/out-1-withpiechart/ppt/slides/_rels/slide9.xml.rels @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withpiechart/ppt/slides/slide1.xml b/experiments/out-1-withpiechart/ppt/slides/slide1.xml new file mode 100644 index 00000000..f7aca3af --- /dev/null +++ b/experiments/out-1-withpiechart/ppt/slides/slide1.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withpiechart/ppt/slides/slide10.xml b/experiments/out-1-withpiechart/ppt/slides/slide10.xml new file mode 100644 index 00000000..5ab4c3ce --- /dev/null +++ b/experiments/out-1-withpiechart/ppt/slides/slide10.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withpiechart/ppt/slides/slide2.xml b/experiments/out-1-withpiechart/ppt/slides/slide2.xml new file mode 100644 index 00000000..ee72ae92 --- /dev/null +++ b/experiments/out-1-withpiechart/ppt/slides/slide2.xml @@ -0,0 +1,2 @@ + +Created using Officegen version 0.2.6Fast positionFull lineHello World!Office generatorBoomBoom!!! \ No newline at end of file diff --git a/experiments/out-1-withpiechart/ppt/slides/slide3.xml b/experiments/out-1-withpiechart/ppt/slides/slide3.xml new file mode 100644 index 00000000..b8a1ba59 --- /dev/null +++ b/experiments/out-1-withpiechart/ppt/slides/slide3.xml @@ -0,0 +1,2 @@ + +Office generator \ No newline at end of file diff --git a/experiments/out-1-withpiechart/ppt/slides/slide4.xml b/experiments/out-1-withpiechart/ppt/slides/slide4.xml new file mode 100644 index 00000000..acc4285d --- /dev/null +++ b/experiments/out-1-withpiechart/ppt/slides/slide4.xml @@ -0,0 +1,2 @@ + +Red lineRed box 1Red box 2 \ No newline at end of file diff --git a/experiments/out-1-withpiechart/ppt/slides/slide5.xml b/experiments/out-1-withpiechart/ppt/slides/slide5.xml new file mode 100644 index 00000000..74c996e7 --- /dev/null +++ b/experiments/out-1-withpiechart/ppt/slides/slide5.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withpiechart/ppt/slides/slide6.xml b/experiments/out-1-withpiechart/ppt/slides/slide6.xml new file mode 100644 index 00000000..8d505524 --- /dev/null +++ b/experiments/out-1-withpiechart/ppt/slides/slide6.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withpiechart/ppt/slides/slide7.xml b/experiments/out-1-withpiechart/ppt/slides/slide7.xml new file mode 100644 index 00000000..ad3fe1e8 --- /dev/null +++ b/experiments/out-1-withpiechart/ppt/slides/slide7.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withpiechart/ppt/slides/slide8.xml b/experiments/out-1-withpiechart/ppt/slides/slide8.xml new file mode 100644 index 00000000..8d505524 --- /dev/null +++ b/experiments/out-1-withpiechart/ppt/slides/slide8.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withpiechart/ppt/slides/slide9.xml b/experiments/out-1-withpiechart/ppt/slides/slide9.xml new file mode 100644 index 00000000..44db8ba4 --- /dev/null +++ b/experiments/out-1-withpiechart/ppt/slides/slide9.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withpiechart/ppt/tableStyles.xml b/experiments/out-1-withpiechart/ppt/tableStyles.xml new file mode 100644 index 00000000..0dd0dff2 --- /dev/null +++ b/experiments/out-1-withpiechart/ppt/tableStyles.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withpiechart/ppt/theme/theme1.xml b/experiments/out-1-withpiechart/ppt/theme/theme1.xml new file mode 100644 index 00000000..ee953eb6 --- /dev/null +++ b/experiments/out-1-withpiechart/ppt/theme/theme1.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experiments/out-1-withpiechart/ppt/viewProps.xml b/experiments/out-1-withpiechart/ppt/viewProps.xml new file mode 100644 index 00000000..af60f095 --- /dev/null +++ b/experiments/out-1-withpiechart/ppt/viewProps.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/lib/basicgen.js b/lib/basicgen.js index 35c5ad0f..489ca9ec 100644 --- a/lib/basicgen.js +++ b/lib/basicgen.js @@ -196,8 +196,10 @@ officegen = function ( options ) { /// @param[in] res_data Optional data to use when creating this resource. /// @param[in] res_cb Callback to generate this resource (for 'buffer' mode only). /// @param[in] is_always Is true if this resource is perment for all the zip of this document type. - /// - gen_private.plugs.intAddAnyResourceToParse = function ( resource_name, type_of_res, res_data, res_cb, is_always ) { + /// @param[in] removed_after_used Is true if we need to delete this file after used. + /// Added by @author vtloc @date 2014Jan10 + /// + gen_private.plugs.intAddAnyResourceToParse = function ( resource_name, type_of_res, res_data, res_cb, is_always, removed_after_used ) { var newRes = {}; newRes.name = resource_name; @@ -205,6 +207,14 @@ officegen = function ( options ) { newRes.data = res_data; newRes.callback = res_cb; newRes.is_perment = is_always; + + // delete the temporatory resources after used + // @author vtloc + // @date 2014Jan10 + if( removed_after_used ) + newRes.removed_after_used = removed_after_used; + else + newRes.removed_after_used = false; gen_private.resources.push ( newRes ); }; @@ -328,6 +338,14 @@ officegen = function ( options ) { } // Endif. archive.append ( resStream, { name: gen_private.resources[cur_index].name }, function () { + if( gen_private.resources[cur_index].removed_after_used ) + { + // delete the temporatory resources after used + // @author vtloc + // @date 2014Jan10 + var fileName = gen_private.resources[cur_index].data || gen_private.resources[cur_index].name; + fs.unlinkSync( fileName ); + } setImmediate ( function() { generateNextResource ( cur_index + 1 ); }); }); @@ -335,6 +353,7 @@ officegen = function ( options ) { setImmediate ( function() { generateNextResource ( cur_index + 1 ); }); } // Endif. + } else { // Removed resource - just ignore it: setImmediate ( function() { generateNextResource ( cur_index + 1 ); }); @@ -351,6 +370,7 @@ officegen = function ( options ) { } // Endif. genobj.emit ( 'finalize', written ); + }); } // Endif. }; diff --git a/lib/genofficechart.js b/lib/genofficechart.js new file mode 100644 index 00000000..3237e565 --- /dev/null +++ b/lib/genofficechart.js @@ -0,0 +1,566 @@ +/// @author vtloc +/// @date 2014Jan09 +/// This module's purpose is to transform +/// +var _ = require('underscore'); +var xmlBuilder = require('xmlbuilder'); + +/// +/// @brief Transform an array of string into an office's compliance structure +/// +/// @param[in] region String +/// The reference cell of the string, for example: $A$1 +/// @param[in] stringArr +/// An array of string, for example: ['foo', 'bar'] +/// +function strRefFromString(region, stringArr) { + var obj = { + 'c:strRef': { + 'c:f' : region, + 'c:strCache': function() { + var result = {}; + result['c:ptCount'] = { '@val' : stringArr.length }; + result['#list'] = []; + for( var i=0; iZ + // used in excel's cell's coordination + while(col > 0 ) + { + var num = col % 26; + col = (col - num ) / 26; + address += String.fromCharCode(65+num-1); + } + + if( isRowAbsolute ) + address += '$'; + + address += row; + + return address; +} + +/// +/// @brief Transform a data object into column chart +/// +/// @param[in] data object +/// { +/// title: 'eSurvey chart', +/// data: [ // array of series +/// { +/// name: 'Income', +/// labels: ['2005', '2006', '2007', '2008', '2009'], +/// values: [23.5, 26.2, 30.1, 29.5, 24.6], +/// colors: ['ff0000', '00ff00', '0000ff', 'ffff00', '00ffff'] // optional +/// }, +/// { +/// name: 'Expense', +/// labels: ['2005', '2006', '2007', '2008', '2009'], +/// values: [18.1, 22.8, 23.9, 25.1, 25], +/// colors: ['ff0000', '00ff00', '0000ff', 'ffff00', '00ffff'] // optional +/// } +/// ] +/// } +/// +function makeColumnChartStringFromData( data ) { + + var series = []; + var rc2a = rowColToSheetAddress; // shortcut + + for( var i=0; i< data['data'].length; i++ ) + { + var serie = data['data'][i]; + var serieData = { + 'c:ser' : { + 'c:idx' : {'@val': i}, + 'c:order' : {'@val': i}, + 'c:tx' : strRefFromString('Sheet1!' + rc2a(1,2+i,true, true), [serie.name]), // serie's value + 'c:invertIfNegative' : {'@val':'0'}, + 'c:cat' : strRefFromString('Sheet1!'+ rc2a(2,1,true, true) + ':' + rc2a(2+serie.labels.length-1,1,true, true), serie.labels), + 'c:val' : numRef('Sheet1!'+rc2a(2,2+i,true, true) + ':' + rc2a(2+serie.labels.length-1,2+i,true, true), serie.values, "General") + } + }; + if (serie.color) { + serieData['c:ser']['c:spPr'] = { + 'a:solidFill': { + 'a:srgbClr': {'@val': serie.color} + } + }; + } + var root = xmlBuilder.create(serieData, {headless: true}); + + series.push(root.end({ pretty: true, indent: ' ', newline: '\n' })); + } + + var seriesString = ""; + + for( var i=0; i\ +\ +\ +\ +\ + \ + \ + \ + \ + ' + + seriesString + + '\ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ +\ +\ + \ + \ + \ + \ + \ + \ + \ + \ +\ +\ +' +} + +/// +/// @brief Transform a data object into pie chart +/// +/// @param[in] data object +/// { +/// title: 'eSurvey chart', +/// data: [ // array of series +/// { +/// name: 'Income', +/// labels: ['2005', '2006', '2007', '2008', '2009'], +/// values: [23.5, 26.2, 30.1, 29.5, 24.6], +/// colors: ['ff0000', '00ff00', '0000ff', 'ffff00', '00ffff'] // optional +/// } +/// ] +/// } +/// +function makePieChartStringFromData( data ) { + var series = []; + var rc2a = rowColToSheetAddress; // shortcut + + for( var i=0; i< data['data'].length; i++ ) + { + var serie = data['data'][i]; + var serieData = { + 'c:ser' : { + 'c:idx' : {'@val': i}, + 'c:order' : {'@val': i}, + 'c:tx' : strRefFromString('Sheet1!' + rc2a(1,2+i,true, true), [serie.name]), // serie's value + 'c:invertIfNegative' : {'@val':'0'}, + 'c:cat' : strRefFromString('Sheet1!'+ rc2a(2,1,true, true) + ':' + rc2a(2+serie.labels.length-1,1,true, true), serie.labels), + 'c:val' : numRef('Sheet1!'+rc2a(2,2+i,true, true) + ':' + rc2a(2+serie.labels.length-1,2+i,true, true), serie.values, "General") + } + }; + if (serie.colors) { + serieData['c:ser']['#list'] = colorRef(serie.colors); + } + var root = xmlBuilder.create(serieData, {headless: true}); + + series.push(root.end({ pretty: true, indent: ' ', newline: '\n' })); + } + + var seriesString = ""; + + for( var i=0; i\ +\ +\ +\ + \ + \ + \ + \ + \ + \ + ' + + seriesString + + '\ + \ + \ + \ + \ + \ + \ + \ +\ +\ + \ + \ + \ + \ + \ + \ + \ + \ +\ +\ +' +} + +/// +/// @brief Transform a data object into pie chart +/// +/// @param[in] data object +/// { +/// title: 'eSurvey chart', +/// data: [ // array of series +/// { +/// name: 'Income', +/// labels: ['2005', '2006', '2007', '2008', '2009'], +/// values: [23.5, 26.2, 30.1, 29.5, 24.6], +/// colors: ['ff0000', '00ff00', '0000ff', 'ffff00', '00ffff'] // optional +/// } +/// ] +/// } +/// +function makeGroupBarChartStringFromData( data ) { + var series = []; + var rc2a = rowColToSheetAddress; // shortcut + + for( var i=0; i< data['data'].length; i++ ) + { + var serie = data['data'][i]; + var serieData = { + 'c:ser' : { + 'c:idx' : {'@val': i}, + 'c:order' : {'@val': i}, + 'c:tx' : strRefFromString('Sheet1!' + rc2a(1,2+i,true, true), [serie.name]), // serie's value + 'c:invertIfNegative' : {'@val':'0'}, + 'c:cat' : strRefFromString('Sheet1!'+ rc2a(2,1,true, true) + ':' + rc2a(2+serie.labels.length-1,1,true, true), serie.labels), + 'c:val' : numRef('Sheet1!'+rc2a(2,2+i,true, true) + ':' + rc2a(2+serie.labels.length-1,2+i,true, true), serie.values, "General") + } + }; + if (serie.color) { + serieData['c:ser']['c:spPr'] = { + 'a:solidFill': { + 'a:srgbClr': {'@val': serie.color} + } + }; + } + var root = xmlBuilder.create(serieData, {headless: true}); + + series.push(root.end({ pretty: true, indent: ' ', newline: '\n' })); + } + + var seriesString = ""; + + for( var i=0; i\ +\ +\ +\ + \ + \ + \ + \ + ' + + seriesString + + '\ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ +\ +\ + \ + \ + \ + \ + \ + \ + \ + \ +\ +\ +'; +} + + +/// +/// @brief Transform a data object into pie chart +/// +/// @param[in] data object +/// { +/// title: 'eSurvey chart', +/// data: [ // array of series +/// { +/// name: 'Income', +/// labels: ['2005', '2006', '2007', '2008', '2009'], +/// values: [23.5, 26.2, 30.1, 29.5, 24.6], +/// color: 'ff0000' +/// } +/// ] +/// } +/// +function makeBarChartStringFromData( data ) { + var series = []; + var rc2a = rowColToSheetAddress; // shortcut + + for( var i=0; i< data['data'].length; i++ ) + { + var serie = data['data'][i]; + var serieData = { + 'c:ser' : { + 'c:idx' : {'@val': i}, + 'c:order' : {'@val': i}, + 'c:tx' : strRefFromString('Sheet1!' + rc2a(1,2+i,true, true), [serie.name]), // serie's value + 'c:invertIfNegative' : {'@val':'0'}, + 'c:cat' : strRefFromString('Sheet1!'+ rc2a(2,1,true, true) + ':' + rc2a(2+serie.labels.length-1,1,true, true), serie.labels), + 'c:val' : numRef('Sheet1!'+rc2a(2,2+i,true, true) + ':' + rc2a(2+serie.labels.length-1,2+i,true, true), serie.values, "General") + } + }; + if (serie.color) { + serieData['c:ser']['c:spPr'] = { + 'a:solidFill': { + 'a:srgbClr': {'@val': serie.color} + } + }; + } + var root = xmlBuilder.create(serieData, {headless: true}); + + series.push(root.end({ pretty: true, indent: ' ', newline: '\n' })); + } + + var seriesString = ""; + + for( var i=0; i\ +\ +\ +\ + \ + \ + \ + \ + ' + + seriesString + + '\ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ +\ +\ + \ + \ + \ + \ + \ + \ + \ + \ +\ +\ +'; +} + + +exports.makePieChartStringFromData = makePieChartStringFromData; +exports.makeColumnChartStringFromData = makeColumnChartStringFromData; +exports.makeBarChartStringFromData = makeBarChartStringFromData; +exports.makeGroupBarChartStringFromData = makeGroupBarChartStringFromData; \ No newline at end of file diff --git a/lib/genpptx.js b/lib/genpptx.js index b2647e24..76577bb7 100644 --- a/lib/genpptx.js +++ b/lib/genpptx.js @@ -27,8 +27,8 @@ // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // - var baseobj = require("./basicgen.js"); +var officeChart = require("./genofficechart.js"); var msdoc = require("./msofficegen.js"); var pptxShapes = require("./pptxshapes.js"); @@ -36,6 +36,8 @@ var path = require('path'); var fast_image_size = require('fast-image-size'); +var excelbuilder = require('./msexcel-builder.js'); + if ( !String.prototype.encodeHTML ) { String.prototype.encodeHTML = function () { return this.replace(/&/g, '&') @@ -45,6 +47,8 @@ if ( !String.prototype.encodeHTML ) { }; } +var GLOBAL_CHART_COUNT = 0; + /// /// @brief Extend officegen object with PPTX/PPSX support. /// @@ -102,7 +106,21 @@ function makePptx ( genobj, new_type, options, gen_private, type_info ) { /// @return Text string. /// function cbMakePptxPresProps ( data ) { - return gen_private.plugs.type.msoffice.cbMakeMsOfficeBasicXml ( data ) + ''; + return gen_private.plugs.type.msoffice.cbMakeMsOfficeBasicXml ( data ) + + +'\ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ +'; } /// @@ -165,7 +183,14 @@ function makePptx ( genobj, new_type, options, gen_private, type_info ) { curPos += 457200; } // End of for loop. - outString += ''; + outString += ''; + + outString += '\ + \ + \ + \ + '; + return outString; } @@ -595,6 +620,65 @@ function makePptx ( genobj, new_type, options, gen_private, type_info ) { } // Endif. switch ( objs_list[i].type ) { + // TODO: remove hard code here + case 'chart': + // loop through the charts + // + + if( objs_list[i].renderType === 'pie' ) + { + outString += '\ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + ' + } + else if( objs_list[i].renderType === 'column' ) + { + outString += '\ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + ' + } + break; case 'text': case 'cxn': var effectsList = ''; @@ -897,6 +981,35 @@ function makePptx ( genobj, new_type, options, gen_private, type_info ) { return outString; } + /// + /// @brief Convert the chart object into xml string + /// + /// @param[in] data + /// @return Text Xml string. + /// + function cbMakeCharts ( data ) { + if( data['renderType'] === 'pie' ) + { + return officeChart.makePieChartStringFromData( data); + } + else if( data['renderType'] === 'column' ) + { + return officeChart.makeColumnChartStringFromData( data); + } + else if( data['renderType'] === 'bar' ) + { + return officeChart.makeBarChartStringFromData( data); + } + else if( data['renderType'] === 'group-bar' ) + { + return officeChart.makeGroupBarChartStringFromData( data); + } + } + + function cbMakeChartDataExcel ( data ) { + + } + // Prepare genobj for MS-Office: msdoc.makemsdoc ( genobj, new_type, options, gen_private, type_info ); gen_private.plugs.type.msoffice.makeOfficeGenerator ( 'ppt', 'presentation', {} ); @@ -948,7 +1061,9 @@ function makePptx ( genobj, new_type, options, gen_private, type_info ) { gen_private.plugs.intAddAnyResourceToParse ( 'ppt\\tableStyles.xml', 'buffer', null, cbMakePptxStyles, true ); gen_private.plugs.intAddAnyResourceToParse ( 'ppt\\viewProps.xml', 'buffer', null, cbMakePptxViewProps, true ); gen_private.plugs.intAddAnyResourceToParse ( 'ppt\\presentation.xml', 'buffer', null, cbMakePptxPresentation, true ); - + + + gen_private.plugs.intAddAnyResourceToParse ( 'ppt\\slideLayouts\\slideLayout1.xml', 'buffer', null, cbMakePptxLayout, true ); gen_private.plugs.intAddAnyResourceToParse ( 'ppt\\slideLayouts\\_rels\\slideLayout1.xml.rels', 'buffer', [ { @@ -1085,6 +1200,167 @@ function makePptx ( genobj, new_type, options, gen_private, type_info ) { }; } + + + /// + /// @brief Generate the chart based on input data. + /// @param[in] renderType should belong to: 'column', 'pie' + /// @param[in] data a JSON object with follow the following format + /// { + /// title: 'eSurvey chart', + /// data: [ + /// { + /// name: 'Income', + /// labels: ['2005', '2006', '2007', '2008', '2009'], + /// values: [23.5, 26.2, 30.1, 29.5, 24.6] + /// }, + /// { + /// name: 'Expense', + /// labels: ['2005', '2006', '2007', '2008', '2009'], + /// values: [18.1, 22.8, 23.9, 25.1, 25] + /// } + /// ] + /// } + /// @author vtloc + /// @date 2014Jan09 + slideObj.addChart = function ( data, renderType, callback, errorCallback ) { + var objNumber = gen_private.pages[pageNumber].data.length; + GLOBAL_CHART_COUNT += 1; + + gen_private.pages[pageNumber].data[objNumber] = {}; + gen_private.pages[pageNumber].data[objNumber].type = 'chart'; + gen_private.pages[pageNumber].data[objNumber].renderType = 'column'; + gen_private.pages[pageNumber].data[objNumber].title = data['title']; + gen_private.pages[pageNumber].data[objNumber].data = data['data']; + data['renderType'] = renderType; + + // First, generate a temporatory excel file for storing the chart's data + var workbook = excelbuilder.createWorkbook('./', 'sample' + GLOBAL_CHART_COUNT + '.xlsx') + + // Create a new worksheet with 10 columns and 12 rows + // number of columns: data['data'].length+1 -> equaly number of series + // number of rows: data['data'][0].values.length+1 + console.log(data); + + var sheet1 = workbook.createSheet('Sheet1', data['data'].length+1, data['data'][0].values.length+1); + var headerrow = 1; + + // write header using serie name + for( var j=0; j < data['data'].length; j++ ) + { + sheet1.set(j+2, headerrow, data['data'][j].name); + } + + // write category column in the first column + for( var j=0; j < data['data'][0].labels.length; j++ ) + { + sheet1.set(1, j+2, data['data'][0].labels[j]); + } + + // for each serie, write out values in its row + for (var i = 0; i < data['data'].length; i++) + { + for( var j=0; j < data['data'][i].values.length; j++ ) + { + // col i+2 + // row j+1 + sheet1.set(i+2, j+2, data['data'][i].values[j]); + } + } + + // Fill some data + // Save it + var localEmbeddingExcelFile = 'ppt\\embeddings\\Microsoft_Excel_Worksheet' + GLOBAL_CHART_COUNT + '.xlsx'; + var tmpExcelFile = './sample'+GLOBAL_CHART_COUNT+'.xlsx'; + // will copy the tmpExcelFile into localEmbeddingExcelFile + gen_private.plugs.intAddAnyResourceToParse ( localEmbeddingExcelFile, 'file', tmpExcelFile, cbMakeChartDataExcel, false, true ); + gen_private.plugs.intAddAnyResourceToParse ( 'ppt\\charts\\chart'+GLOBAL_CHART_COUNT+'.xml', 'buffer', data, cbMakeCharts, true ); + gen_private.plugs.intAddAnyResourceToParse ( 'ppt\\charts\\_rels\\chart'+GLOBAL_CHART_COUNT+'.xml.rels', 'buffer', [ + { + type: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/package', + target: '../embeddings/Microsoft_Excel_Worksheet'+GLOBAL_CHART_COUNT+'.xlsx' + } + ], gen_private.plugs.type.msoffice.cbMakeRels, true ); + gen_private.type.msoffice.files_list.push ( + { + name: '/ppt/charts/chart'+GLOBAL_CHART_COUNT+'.xml', + type: 'application/vnd.openxmlformats-officedocument.drawingml.chart+xml', + clear: 'type' + }, + { + name: '/ppt/embeddings/Microsoft_Excel_Worksheet'+GLOBAL_CHART_COUNT+'.xlsx', + type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', + ext: 'xlsx', + clear: 'type' + } + ); + + gen_private.pages[pageNumber].rels.push ( + { + type: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart', + target: '../charts/chart'+GLOBAL_CHART_COUNT+'.xml', + clear: 'data' + }); + + workbook.save(function(err){ + if (err) + { + workbook.cancel(); + } + else + { + console.log(tmpExcelFile + ' generated'); + callback(); + } + }); + + + } + + /// + /// @brief Generate the column chart based on input data. + /// + /// @param[in] data a JSON object with follow the following format + /// { + /// title: 'eSurvey chart', + /// data: [ + /// { + /// name: 'Income', + /// labels: ['2005', '2006', '2007', '2008', '2009'], + /// values: [23.5, 26.2, 30.1, 29.5, 24.6] + /// }, + /// { + /// name: 'Expense', + /// labels: ['2005', '2006', '2007', '2008', '2009'], + /// values: [18.1, 22.8, 23.9, 25.1, 25] + /// } + /// ] + /// } + /// + slideObj.addColumnChart = function ( data, cb, errCb) { + this.addChart( data, 'column', cb, errCb ); + } + + /// + /// @brief Generate the pie chart based on input data. + /// @author vtloc + /// @date 2014Jan09 + slideObj.addPieChart = function ( data, cb, errCb) { + this.addChart( data, 'pie'); + } + + /// + /// @brief Generate the bar chart based on input data. + /// @author vtloc + /// @date 2014Jan09 + slideObj.addBarChart = function ( data, cb, errCb) { + this.addChart( data, 'bar'); + } + + slideObj.addGroupBarChart = function (data, cb, errCb ) { + this.addChart( data, 'group-bar'); + } + /// /// @brief ???. /// diff --git a/lib/msexcel-builder.js b/lib/msexcel-builder.js new file mode 100644 index 00000000..08501211 --- /dev/null +++ b/lib/msexcel-builder.js @@ -0,0 +1,890 @@ +/* + MS Excel 2007 Creater v0.0.1 + Author : chuanyi.zheng@gmail.com + History: 2012/11/07 first created +*/ + + +(function() { + var ContentTypes, DocPropsApp, SharedStrings, Sheet, Style, Workbook, XlRels, XlWorkbook, exec, existsSync, fs, opt, path, tool, xml, + __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; + + fs = require('fs'); + + path = require('path'); + + exec = require('child_process'); + + xml = require('xmlbuilder'); + + existsSync = fs.existsSync || path.existsSync; + + tool = { + i2a: function(i) { + return 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.charAt(i - 1); + }, + copy: function(origin, target) { + var f, files, oCur, s, tCur, _i, _len, _results; + if (existsSync(origin)) { + if (!existsSync(target)) { + fs.mkdirSync(target, 0755); + } + files = fs.readdirSync(origin); + if (files) { + _results = []; + for (_i = 0, _len = files.length; _i < _len; _i++) { + f = files[_i]; + oCur = origin + '/' + f; + tCur = target + '/' + f; + s = fs.statSync(oCur); + if (s.isFile()) { + _results.push(fs.writeFileSync(tCur, fs.readFileSync(oCur, ''), '')); + } else { + if (s.isDirectory()) { + _results.push(tool.copy(oCur, tCur)); + } else { + _results.push(void 0); + } + } + } + return _results; + } + } + } + }; + + opt = { + tmpl_path: __dirname + }; + + ContentTypes = (function() { + function ContentTypes(book) { + this.book = book; + } + + ContentTypes.prototype.toxml = function() { + var i, types, _i, _ref; + types = xml.create('Types', { + version: '1.0', + encoding: 'UTF-8', + standalone: true + }); + types.att('xmlns', 'http://schemas.openxmlformats.org/package/2006/content-types'); + types.ele('Override', { + PartName: '/xl/theme/theme1.xml', + ContentType: 'application/vnd.openxmlformats-officedocument.theme+xml' + }); + types.ele('Override', { + PartName: '/xl/styles.xml', + ContentType: 'application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml' + }); + types.ele('Default', { + Extension: 'rels', + ContentType: 'application/vnd.openxmlformats-package.relationships+xml' + }); + types.ele('Default', { + Extension: 'xml', + ContentType: 'application/xml' + }); + types.ele('Override', { + PartName: '/xl/workbook.xml', + ContentType: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml' + }); + types.ele('Override', { + PartName: '/docProps/app.xml', + ContentType: 'application/vnd.openxmlformats-officedocument.extended-properties+xml' + }); + for (i = _i = 1, _ref = this.book.sheets.length; 1 <= _ref ? _i <= _ref : _i >= _ref; i = 1 <= _ref ? ++_i : --_i) { + types.ele('Override', { + PartName: '/xl/worksheets/sheet' + i + '.xml', + ContentType: 'application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml' + }); + } + types.ele('Override', { + PartName: '/xl/sharedStrings.xml', + ContentType: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml' + }); + types.ele('Override', { + PartName: '/docProps/core.xml', + ContentType: 'application/vnd.openxmlformats-package.core-properties+xml' + }); + return types.end(); + }; + + return ContentTypes; + + })(); + + DocPropsApp = (function() { + function DocPropsApp(book) { + this.book = book; + } + + DocPropsApp.prototype.toxml = function() { + var i, props, tmp, _i, _ref; + props = xml.create('Properties', { + version: '1.0', + encoding: 'UTF-8', + standalone: true + }); + props.att('xmlns', 'http://schemas.openxmlformats.org/officeDocument/2006/extended-properties'); + props.att('xmlns:vt', 'http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes'); + props.ele('Application', 'Microsoft Excel'); + props.ele('DocSecurity', '0'); + props.ele('ScaleCrop', 'false'); + tmp = props.ele('HeadingPairs').ele('vt:vector', { + size: 2, + baseType: 'variant' + }); + tmp.ele('vt:variant').ele('vt:lpstr', '???'); + tmp.ele('vt:variant').ele('vt:i4', '' + this.book.sheets.length); + tmp = props.ele('TitlesOfParts').ele('vt:vector', { + size: this.book.sheets.length, + baseType: 'lpstr' + }); + for (i = _i = 1, _ref = this.book.sheets.length; 1 <= _ref ? _i <= _ref : _i >= _ref; i = 1 <= _ref ? ++_i : --_i) { + tmp.ele('vt:lpstr', this.book.sheets[i - 1].name); + } + props.ele('Company'); + props.ele('LinksUpToDate', 'false'); + props.ele('SharedDoc', 'false'); + props.ele('HyperlinksChanged', 'false'); + props.ele('AppVersion', '12.0000'); + return props.end(); + }; + + return DocPropsApp; + + })(); + + XlWorkbook = (function() { + function XlWorkbook(book) { + this.book = book; + } + + XlWorkbook.prototype.toxml = function() { + var i, tmp, wb, _i, _ref; + wb = xml.create('workbook', { + version: '1.0', + encoding: 'UTF-8', + standalone: true + }); + wb.att('xmlns', 'http://schemas.openxmlformats.org/spreadsheetml/2006/main'); + wb.att('xmlns:r', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships'); + wb.ele('fileVersion ', { + appName: 'xl', + lastEdited: '4', + lowestEdited: '4', + rupBuild: '4505' + }); + wb.ele('workbookPr', { + filterPrivacy: '1', + defaultThemeVersion: '124226' + }); + wb.ele('bookViews').ele('workbookView ', { + xWindow: '0', + yWindow: '90', + windowWidth: '19200', + windowHeight: '11640' + }); + tmp = wb.ele('sheets'); + for (i = _i = 1, _ref = this.book.sheets.length; 1 <= _ref ? _i <= _ref : _i >= _ref; i = 1 <= _ref ? ++_i : --_i) { + tmp.ele('sheet', { + name: this.book.sheets[i - 1].name, + sheetId: '' + i, + 'r:id': 'rId' + i + }); + } + wb.ele('calcPr', { + calcId: '124519' + }); + return wb.end(); + }; + + return XlWorkbook; + + })(); + + XlRels = (function() { + function XlRels(book) { + this.book = book; + } + + XlRels.prototype.toxml = function() { + var i, rs, _i, _ref; + rs = xml.create('Relationships', { + version: '1.0', + encoding: 'UTF-8', + standalone: true + }); + rs.att('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships'); + for (i = _i = 1, _ref = this.book.sheets.length; 1 <= _ref ? _i <= _ref : _i >= _ref; i = 1 <= _ref ? ++_i : --_i) { + rs.ele('Relationship', { + Id: 'rId' + i, + Type: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet', + Target: 'worksheets/sheet' + i + '.xml' + }); + } + rs.ele('Relationship', { + Id: 'rId' + (this.book.sheets.length + 1), + Type: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme', + Target: 'theme/theme1.xml' + }); + rs.ele('Relationship', { + Id: 'rId' + (this.book.sheets.length + 2), + Type: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles', + Target: 'styles.xml' + }); + rs.ele('Relationship', { + Id: 'rId' + (this.book.sheets.length + 3), + Type: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings', + Target: 'sharedStrings.xml' + }); + return rs.end(); + }; + + return XlRels; + + })(); + + SharedStrings = (function() { + function SharedStrings() { + this.cache = {}; + this.arr = []; + } + + SharedStrings.prototype.str2id = function(s) { + var id; + id = this.cache[s]; + if (id) { + return id; + } else { + this.arr.push(s); + this.cache[s] = this.arr.length; + return this.arr.length; + } + }; + + SharedStrings.prototype.toxml = function() { + var i, si, sst, _i, _ref; + sst = xml.create('sst', { + version: '1.0', + encoding: 'UTF-8', + standalone: true + }); + sst.att('xmlns', 'http://schemas.openxmlformats.org/spreadsheetml/2006/main'); + sst.att('count', '' + this.arr.length); + sst.att('uniqueCount', '' + this.arr.length); + for (i = _i = 0, _ref = this.arr.length; 0 <= _ref ? _i < _ref : _i > _ref; i = 0 <= _ref ? ++_i : --_i) { + si = sst.ele('si'); + si.ele('t', this.arr[i]); + si.ele('phoneticPr', { + fontId: 1, + type: 'noConversion' + }); + } + return sst.end(); + }; + + return SharedStrings; + + })(); + + Sheet = (function() { + function Sheet(book, name, cols, rows) { + var i, j, _i, _j, _ref, _ref1; + this.book = book; + this.name = name; + this.cols = cols; + this.rows = rows; + this.data = {}; + for (i = _i = 1, _ref = this.rows; 1 <= _ref ? _i <= _ref : _i >= _ref; i = 1 <= _ref ? ++_i : --_i) { + this.data[i] = {}; + for (j = _j = 1, _ref1 = this.cols; 1 <= _ref1 ? _j <= _ref1 : _j >= _ref1; j = 1 <= _ref1 ? ++_j : --_j) { + this.data[i][j] = { + v: 0, + dataType: 'string' + }; + } + } + this.merges = []; + this.col_wd = []; + this.row_ht = {}; + this.styles = {}; + } + + Sheet.prototype.set = function(col, row, value) { + if ((typeof value) === "string") { + if ((value != null) && value !== '') { + this.data[row][col].v = this.book.ss.str2id('' + value); + } + return this.data[row][col].dataType = 'string'; + } else { + this.data[row][col].v = value; + return this.data[row][col].dataType = 'number'; + } + }; + + Sheet.prototype.merge = function(from_cell, to_cell) { + return this.merges.push({ + from: from_cell, + to: to_cell + }); + }; + + Sheet.prototype.width = function(col, wd) { + return this.col_wd.push({ + c: col, + cw: wd + }); + }; + + Sheet.prototype.height = function(row, ht) { + return this.row_ht[row] = ht; + }; + + Sheet.prototype.font = function(col, row, font_s) { + return this.styles['font_' + col + '_' + row] = this.book.st.font2id(font_s); + }; + + Sheet.prototype.fill = function(col, row, fill_s) { + return this.styles['fill_' + col + '_' + row] = this.book.st.fill2id(fill_s); + }; + + Sheet.prototype.border = function(col, row, bder_s) { + return this.styles['bder_' + col + '_' + row] = this.book.st.bder2id(bder_s); + }; + + Sheet.prototype.align = function(col, row, align_s) { + return this.styles['algn_' + col + '_' + row] = align_s; + }; + + Sheet.prototype.valign = function(col, row, valign_s) { + return this.styles['valgn_' + col + '_' + row] = valign_s; + }; + + Sheet.prototype.rotate = function(col, row, textRotation) { + return this.styles['rotate_' + col + '_' + row] = textRotation; + }; + + Sheet.prototype.wrap = function(col, row, wrap_s) { + return this.styles['wrap_' + col + '_' + row] = wrap_s; + }; + + Sheet.prototype.style_id = function(col, row) { + var id, inx, style; + inx = '_' + col + '_' + row; + style = { + font_id: this.styles['font' + inx], + fill_id: this.styles['fill' + inx], + bder_id: this.styles['bder' + inx], + align: this.styles['algn' + inx], + valign: this.styles['valgn' + inx], + rotate: this.styles['rotate' + inx], + wrap: this.styles['wrap' + inx] + }; + id = this.book.st.style2id(style); + return id; + }; + + Sheet.prototype.toxml = function() { + var c, cols, cw, ht, i, ix, j, m, mc, r, sd, sid, ws, _i, _j, _k, _l, _len, _len1, _ref, _ref1, _ref2, _ref3; + ws = xml.create('worksheet', { + version: '1.0', + encoding: 'UTF-8', + standalone: true + }); + ws.att('xmlns', 'http://schemas.openxmlformats.org/spreadsheetml/2006/main'); + ws.att('xmlns:r', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships'); + ws.ele('dimension', { + ref: 'A1' + }); + ws.ele('sheetViews').ele('sheetView', { + workbookViewId: '0' + }); + ws.ele('sheetFormatPr', { + defaultRowHeight: '13.5' + }); + if (this.col_wd.length > 0) { + cols = ws.ele('cols'); + _ref = this.col_wd; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + cw = _ref[_i]; + cols.ele('col', { + min: '' + cw.c, + max: '' + cw.c, + width: cw.cw, + customWidth: '1' + }); + } + } + sd = ws.ele('sheetData'); + for (i = _j = 1, _ref1 = this.rows; 1 <= _ref1 ? _j <= _ref1 : _j >= _ref1; i = 1 <= _ref1 ? ++_j : --_j) { + r = sd.ele('row', { + r: '' + i, + spans: '1:' + this.cols + }); + ht = this.row_ht[i]; + if (ht) { + r.att('ht', ht); + r.att('customHeight', '1'); + } + for (j = _k = 1, _ref2 = this.cols; 1 <= _ref2 ? _k <= _ref2 : _k >= _ref2; j = 1 <= _ref2 ? ++_k : --_k) { + ix = this.data[i][j]; + sid = this.style_id(j, i); + if ((ix.v !== 0) || (sid !== 1)) { + c = r.ele('c', { + r: '' + tool.i2a(j) + i + }); + if (sid !== 1) { + c.att('s', '' + (sid - 1)); + } + if (ix.v !== 0) { + if (ix.dataType === "string") { + c.att('t', 's'); + c.ele('v', '' + (ix.v - 1)); + } else if (ix.dataType === "number") { + c.ele('v', '' + ix.v); + } else { + c.ele('v', '' + ix.v); + } + } + } + } + } + if (this.merges.length > 0) { + mc = ws.ele('mergeCells', { + count: this.merges.length + }); + _ref3 = this.merges; + for (_l = 0, _len1 = _ref3.length; _l < _len1; _l++) { + m = _ref3[_l]; + mc.ele('mergeCell', { + ref: '' + tool.i2a(m.from.col) + m.from.row + ':' + tool.i2a(m.to.col) + m.to.row + }); + } + } + ws.ele('phoneticPr', { + fontId: '1', + type: 'noConversion' + }); + ws.ele('pageMargins', { + left: '0.7', + right: '0.7', + top: '0.75', + bottom: '0.75', + header: '0.3', + footer: '0.3' + }); + ws.ele('pageSetup', { + paperSize: '9', + orientation: 'portrait', + horizontalDpi: '200', + verticalDpi: '200' + }); + return ws.end(); + }; + + return Sheet; + + })(); + + Style = (function() { + function Style(book) { + this.book = book; + this.cache = {}; + this.mfonts = []; + this.mfills = []; + this.mbders = []; + this.mstyle = []; + this.with_default(); + } + + Style.prototype.with_default = function() { + this.def_font_id = this.font2id(null); + this.def_fill_id = this.fill2id(null); + this.def_bder_id = this.bder2id(null); + this.def_align = '-'; + this.def_valign = '-'; + this.def_rotate = '-'; + this.def_wrap = '-'; + return this.def_style_id = this.style2id({ + font_id: this.def_font_id, + fill_id: this.def_fill_id, + bder_id: this.def_bder_id, + align: this.def_align, + valign: this.def_valign, + rotate: this.def_rotate + }); + }; + + Style.prototype.font2id = function(font) { + var id, k; + font || (font = {}); + font.bold || (font.bold = '-'); + font.iter || (font.iter = '-'); + font.sz || (font.sz = '11'); + font.color || (font.color = '-'); + font.name || (font.name = 'Arial'); + font.scheme || (font.scheme = 'minor'); + font.family || (font.family = '2'); + k = 'font_' + font.bold + font.iter + font.sz + font.color + font.name + font.scheme + font.family; + id = this.cache[k]; + if (id) { + return id; + } else { + this.mfonts.push(font); + this.cache[k] = this.mfonts.length; + return this.mfonts.length; + } + }; + + Style.prototype.fill2id = function(fill) { + var id, k; + fill || (fill = {}); + fill.type || (fill.type = 'none'); + fill.bgColor || (fill.bgColor = '-'); + fill.fgColor || (fill.fgColor = '-'); + k = 'fill_' + fill.type + fill.bgColor + fill.fgColor; + id = this.cache[k]; + if (id) { + return id; + } else { + this.mfills.push(fill); + this.cache[k] = this.mfills.length; + return this.mfills.length; + } + }; + + Style.prototype.bder2id = function(bder) { + var id, k; + bder || (bder = {}); + bder.left || (bder.left = '-'); + bder.right || (bder.right = '-'); + bder.top || (bder.top = '-'); + bder.bottom || (bder.bottom = '-'); + k = 'bder_' + bder.left + '_' + bder.right + '_' + bder.top + '_' + bder.bottom; + id = this.cache[k]; + if (id) { + return id; + } else { + this.mbders.push(bder); + this.cache[k] = this.mbders.length; + return this.mbders.length; + } + }; + + Style.prototype.style2id = function(style) { + var id, k; + style.align || (style.align = this.def_align); + style.valign || (style.valign = this.def_valign); + style.rotate || (style.rotate = this.def_rotate); + style.wrap || (style.wrap = this.def_wrap); + style.font_id || (style.font_id = this.def_font_id); + style.fill_id || (style.fill_id = this.def_fill_id); + style.bder_id || (style.bder_id = this.def_bder_id); + k = 's_' + style.font_id + '_' + style.fill_id + '_' + style.bder_id + '_' + style.align + '_' + style.valign + '_' + style.wrap + '_' + style.rotate; + id = this.cache[k]; + if (id) { + return id; + } else { + this.mstyle.push(style); + this.cache[k] = this.mstyle.length; + return this.mstyle.length; + } + }; + + Style.prototype.toxml = function() { + var bders, cs, e, ea, es, fills, fonts, o, ss, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref, _ref1, _ref2, _ref3; + ss = xml.create('styleSheet', { + version: '1.0', + encoding: 'UTF-8', + standalone: true + }); + ss.att('xmlns', 'http://schemas.openxmlformats.org/spreadsheetml/2006/main'); + fonts = ss.ele('fonts', { + count: this.mfonts.length + }); + _ref = this.mfonts; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + o = _ref[_i]; + e = fonts.ele('font'); + if (o.bold !== '-') { + e.ele('b'); + } + if (o.iter !== '-') { + e.ele('i'); + } + e.ele('sz', { + val: o.sz + }); + if (o.color !== '-') { + e.ele('color', { + theme: o.color + }); + } + e.ele('name', { + val: o.name + }); + e.ele('family', { + val: o.family + }); + e.ele('charset', { + val: '134' + }); + if (o.scheme !== '-') { + e.ele('scheme', { + val: 'minor' + }); + } + } + fills = ss.ele('fills', { + count: this.mfills.length + }); + _ref1 = this.mfills; + for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { + o = _ref1[_j]; + e = fills.ele('fill'); + es = e.ele('patternFill', { + patternType: o.type + }); + if (o.fgColor !== '-') { + es.ele('fgColor', { + theme: '8', + tint: '0.79998168889431442' + }); + } + if (o.bgColor !== '-') { + es.ele('bgColor', { + indexed: o.bgColor + }); + } + } + bders = ss.ele('borders', { + count: this.mbders.length + }); + _ref2 = this.mbders; + for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) { + o = _ref2[_k]; + e = bders.ele('border'); + if (o.left !== '-') { + e.ele('left', { + style: o.left + }).ele('color', { + auto: '1' + }); + } else { + e.ele('left'); + } + if (o.right !== '-') { + e.ele('right', { + style: o.right + }).ele('color', { + auto: '1' + }); + } else { + e.ele('right'); + } + if (o.top !== '-') { + e.ele('top', { + style: o.top + }).ele('color', { + auto: '1' + }); + } else { + e.ele('top'); + } + if (o.bottom !== '-') { + e.ele('bottom', { + style: o.bottom + }).ele('color', { + auto: '1' + }); + } else { + e.ele('bottom'); + } + e.ele('diagonal'); + } + ss.ele('cellStyleXfs', { + count: '1' + }).ele('xf', { + numFmtId: '0', + fontId: '0', + fillId: '0', + borderId: '0' + }).ele('alignment', { + vertical: 'center' + }); + cs = ss.ele('cellXfs', { + count: this.mstyle.length + }); + _ref3 = this.mstyle; + for (_l = 0, _len3 = _ref3.length; _l < _len3; _l++) { + o = _ref3[_l]; + e = cs.ele('xf', { + numFmtId: '0', + fontId: o.font_id - 1, + fillId: o.fill_id - 1, + borderId: o.bder_id - 1, + xfId: '0' + }); + if (o.font_id !== 1) { + e.att('applyFont', '1'); + } + if (o.fill_id !== 1) { + e.att('applyFill', '1'); + } + if (o.bder_id !== 1) { + e.att('applyBorder', '1'); + } + if (o.align !== '-' || o.valign !== '-' || o.wrap !== '-') { + e.att('applyAlignment', '1'); + ea = e.ele('alignment', { + textRotation: (o.rotate === '-' ? '0' : o.rotate), + horizontal: (o.align === '-' ? 'left' : o.align), + vertical: (o.valign === '-' ? 'top' : o.valign) + }); + if (o.wrap !== '-') { + ea.att('wrapText', '1'); + } + } + } + ss.ele('cellStyles', { + count: '1' + }).ele('cellStyle', { + name: '??', + xfId: '0', + builtinId: '0' + }); + ss.ele('dxfs', { + count: '0' + }); + ss.ele('tableStyles', { + count: '0', + defaultTableStyle: 'TableStyleMedium9', + defaultPivotStyle: 'PivotStyleLight16' + }); + return ss.end(); + }; + + return Style; + + })(); + + Workbook = (function() { + function Workbook(fpath, fname) { + var target; + this.fpath = fpath; + this.fname = fname; + this.save = __bind(this.save, this); + this.id = '' + parseInt(Math.random() * 9999999); + target = path.join(path.resolve(this.fpath), this.id); + if (existsSync(target)) { + fs.rmdirSync(target); + } + tool.copy(opt.tmpl_path + '/tmpl', target); + this.sheets = []; + this.ss = new SharedStrings; + this.ct = new ContentTypes(this); + this.da = new DocPropsApp(this); + this.wb = new XlWorkbook(this); + this.re = new XlRels(this); + this.st = new Style(this); + } + + Workbook.prototype.createSheet = function(name, cols, rows) { + var sheet; + sheet = new Sheet(this, name, cols, rows); + this.sheets.push(sheet); + return sheet; + }; + + Workbook.prototype.save = function(cb) { + var args, i, opts, target, _i, _ref; + target = path.join(path.resolve(this.fpath), this.id); + if (!fs.existsSync(target)) { + fs.mkdirSync(target, function(e) { + return; + if (!e || (e && e.code === 'EEXIST')) { + return console.log(path + 'created'); + } else { + return console.log(e); + } + }); + } + fs.writeFileSync(path.join(target, '[Content_Types].xml'), this.ct.toxml(), 'utf8'); + if (!fs.existsSync(path.join(target, 'docProps'))) { + fs.mkdirSync(path.join(target, 'docProps'), function(e) { + return; + if (!e || (e && e.code === 'EEXIST')) { + return console.log(path + 'created'); + } else { + return console.log(e); + } + }); + } + fs.writeFileSync(path.join(target, 'docProps', 'app.xml'), this.da.toxml(), 'utf8'); + if (!fs.existsSync(path.join(target, 'xl'))) { + fs.mkdirSync(path.join(target, 'xl'), function(e) { + return; + if (!e || (e && e.code === 'EEXIST')) { + return console.log(path + 'created'); + } else { + return console.log(e); + } + }); + } + fs.writeFileSync(path.join(target, 'xl', 'workbook.xml'), this.wb.toxml(), 'utf8'); + fs.writeFileSync(path.join(target, 'xl', 'sharedStrings.xml'), this.ss.toxml(), 'utf8'); + fs.mkdirSync(path.join(target, path.join('xl', '_rels')), function(e) { + return; + if (!e || (e && e.code === 'EEXIST')) { + return console.log(path + 'created'); + } else { + return console.log(e); + } + }); + fs.writeFileSync(path.join(target, 'xl', '_rels', 'workbook.xml.rels'), this.re.toxml(), 'utf8'); + fs.mkdirSync(path.join(target, path.join('xl', 'worksheets')), function(e) { + return; + if (!e || (e && e.code === 'EEXIST')) { + return console.log(path + 'created'); + } else { + return console.log(e); + } + }); + for (i = _i = 0, _ref = this.sheets.length; 0 <= _ref ? _i < _ref : _i > _ref; i = 0 <= _ref ? ++_i : --_i) { + fs.writeFileSync(path.join(target, 'xl', 'worksheets', 'sheet' + (i + 1) + '.xml'), this.sheets[i].toxml(), 'utf8'); + } + fs.writeFileSync(path.join(target, 'xl', 'styles.xml'), this.st.toxml(), 'utf8'); + args = ' a -tzip "' + path.join(path.resolve('..'), this.fname) + '" "*"'; // zip -r path . + opts = { + cwd: target + }; + + var p = 'cd ' + target + '/; zip -r ../' + this.fname + ' .; cd ..;'; + + return exec.exec(p, function(err, stdout, stderr) { + console.log('Check ', err, stdout, stderr); + return exec.exec('rm -r ' + target, function() { + console.log(err); + return cb(err); + }); + }); + }; + + Workbook.prototype.cancel = function() { + return fs.rmdirSync(target); + }; + + return Workbook; + + })(); + + module.exports = { + createWorkbook: function(fpath, fname) { + return new Workbook(fpath, fname); + } + }; + +}).call(this); diff --git a/lib/msofficegen.js b/lib/msofficegen.js index de282a3a..c009f832 100644 --- a/lib/msofficegen.js +++ b/lib/msofficegen.js @@ -109,8 +109,14 @@ function makemsdoc ( genobj, new_type, options, gen_private, type_info ) { if ( typeof gen_private.type.msoffice.files_list[i] != 'undefined' ) { if ( gen_private.type.msoffice.files_list[i].ext ) { - outString += ''; - + + // Fixed by @author:vtloc @date:2014Jan09 + // Reason: if we write out duplicate extension, office will raise error + // + if( outString.indexOf(''; + } } else { outString += ''; diff --git a/lib/tmpl/_rels/.rels b/lib/tmpl/_rels/.rels new file mode 100644 index 00000000..74bfd8d9 --- /dev/null +++ b/lib/tmpl/_rels/.rels @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/lib/tmpl/docProps/core.xml b/lib/tmpl/docProps/core.xml new file mode 100644 index 00000000..a3e79be7 --- /dev/null +++ b/lib/tmpl/docProps/core.xml @@ -0,0 +1,2 @@ + +Administrator2006-09-13T11:21:51Z2006-09-13T11:21:55Z \ No newline at end of file diff --git a/lib/tmpl/xl/styles.xml b/lib/tmpl/xl/styles.xml new file mode 100644 index 00000000..29bd3edb --- /dev/null +++ b/lib/tmpl/xl/styles.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/lib/tmpl/xl/theme/theme1.xml b/lib/tmpl/xl/theme/theme1.xml new file mode 100644 index 00000000..e4f5fce3 --- /dev/null +++ b/lib/tmpl/xl/theme/theme1.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/lib/tool/7za.exe b/lib/tool/7za.exe new file mode 100644 index 00000000..bd30a516 Binary files /dev/null and b/lib/tool/7za.exe differ diff --git a/package.json b/package.json index 30f637bd..c5c06c7a 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { - "name": "officegen", + "name": "officegen-2", "description": "Office Open XML Generator using Node.js streams. Supporting Microsoft Office 2007 and later Word (docx), PowerPoint (pptx,ppsx) and Excel (xlsx). This module is for all frameworks and environments. No need for any commandline tool - this module is doing everything inside it.", - "version": "0.2.6", - "url": "https://github.com/Ziv-Barber/officegen", + "version": "0.3.5", + "url": "https://github.com/vtloc/officegen", "keywords": [ "officegen", "office", @@ -25,10 +25,10 @@ ], "repository": { "type": "git", - "url": "git://github.com/Ziv-Barber/officegen.git" + "url": "https://github.com/vtloc/officegen.git" }, "bugs": { - "url": "https://github.com/Ziv-Barber/officegen/issues" + "url": "https://github.com/vtloc/officegen/issues" }, "main": "lib/index.js", "directories": { @@ -41,17 +41,30 @@ "dependencies": { "setimmediate": ">= 1.0.1", "readable-stream": "~1.0.0", - "archiver": ">= 0.4.4", - "fast-image-size": "*" + "archiver": "~0.4.10", + "fast-image-size": "*", + "underscore" : "*", + "xmlbuilder" : "*", + "coffee-script": "*", + "moment": "~2.5.0" }, "author": { "name": "Ziv Barber", "url": "http://code.zivbarber.com/" }, - "licenses": [ - { - "type": "MIT", - "url": "https://github.com/Ziv-Barber/officegen/blob/master/LICENSE-MIT" - } - ] + "devDependencies": { + "grunt": "~0.4.2", + "grunt-contrib-less": "~0.8.2", + "grunt-contrib-watch": "~0.5.3", + "grunt-contrib-coffee": "~0.7.0", + "grunt-contrib-mincss": "~0.3.2", + "grunt-contrib-cssmin": "~0.7.0", + "grunt-contrib-uglify": "~0.2.7" + }, + "licenses": [ + { + "type": "MIT", + "url": "https://github.com/Ziv-Barber/officegen/blob/master/LICENSE-MIT" + } + ] } diff --git a/run_test.py b/run_test.py new file mode 100644 index 00000000..73183d47 --- /dev/null +++ b/run_test.py @@ -0,0 +1,10 @@ +from subprocess import call +import shutil +import subprocess + +call("npm test", shell=True) + +#shutil.rmtree( "out", True ) +#call(["./tools/unzip.exe", "out.pptx", "-d", "out"]) + +call('start out.pptx', shell=True) diff --git a/tools/unzip.exe b/tools/unzip.exe new file mode 100644 index 00000000..e9dc44df Binary files /dev/null and b/tools/unzip.exe differ diff --git a/tools/zip.exe b/tools/zip.exe new file mode 100644 index 00000000..286227a6 Binary files /dev/null and b/tools/zip.exe differ