Top Level Namespace
Defined Under Namespace
Modules: PPTX
Instance Method Summary collapse
Instance Method Details
#main ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/pptx/generate_sample.rb', line 10 def main pkg = PPTX::OPC::Package.new = PPTX::Slide.new(pkg) # slide size: 25.4cm x 19.05 title_dimensions = PPTX::cm(2, 1, 22, 2) date_dimensions = PPTX::cm(2, 2.8, 5, 2) text_dimensions = PPTX::cm(14, 6, 10, 10) image_dimensions = PPTX::cm(2, 5, 10, 10) .add_textbox title_dimensions, 'Title :)', sz: 45*PPTX::POINT .add_textbox date_dimensions, '18 Feb 2015' .add_textbox text_dimensions, "Text box text with long text that should be broken " + "down into multiple lines.\n:)\nwith<stuff>&to<be>escaped\nYay!" image = PPTX::OPC::FilePart.new(pkg, 'spec/fixtures/test_picture.png') .add_picture image_dimensions, 'photo.jpg', image .add_filled_rectangle(PPTX::cm(24.9, 0, 0.5, 19.05), '558ed5') .(PPTX::cm(23.4, 17.5, 1, 0.8), 1, sz: 12*PPTX::POINT, color: '4d4d4d', align: 'r') pkg.presentation.() = PPTX::Slide.new(pkg) .add_textbox title_dimensions, 'Very long title that should be broken up into multiple' + 'lines and possibly clipped', sz: 45*PPTX::POINT .add_textbox date_dimensions, '17 Feb 2015' .add_textbox text_dimensions, "Text box text with long text that should be broken " + "up into multiple lines and should overflow overflow" + " overflowoverflowoverflowoverflowoverflowoverflow" + " overflow overflow overflow overflow overflow overflow" + " overflow overflow overflow overflow overflow overflow" + " overflow overflow overflow overflow overflow overflow" + " overflow overflow overflow overflow overflow overflow" + " overflow overflow overflow overflow overflow overflow" + " overflow overflow overflow overflow overflow overflow" + " overflow overflow overflow overflow overflow overflow" pkg.presentation.() File.open('tmp/generated.pptx', 'wb') {|f| f.write(pkg.to_zip) } end |