javascript - 使用 Rails 创建 powerpoint 演示文稿

标签 javascript ruby-on-rails ruby web powerpoint

我处于这样一种情况,我必须以编程方式构建 PowerPoint 演示文稿并通过 Web 应用程序提供生成的 ppt 文件,最好使用 Rails、JavaScript 或 Ruby。这可能吗?如果是,如何以及使用哪些工具?

我愿意接受有关如何最好地解决此问题的任何和所有建议。谢谢!

最佳答案

这个 ruby 似乎比当前接受的答案中提到的更成熟。

https://github.com/pythonicrubyist/powerpoint http://rubygems.org/gems/powerpoint

require 'powerpoint'

@deck = Powerpoint::Presentation.new

# Creating an introduction slide:
title = 'Bicycle Of the Mind'
subtitle = 'created by Steve Jobs'
@deck.add_intro title, subtitle

# Creating a text-only slide:
# Title must be a string.
# Content must be an array of strings that will be displayed as bullet items.
title = 'Why Mac?'
content = ['Its cool!', 'Its light.']
@deck.add_textual_slide title, content

# Creating an image Slide:
# It will contain a title as string.
# and an embeded image
title = 'Everyone loves Macs:'
image_path = 'samples/images/sample_gif.gif'
@deck.add_pictorial_slide title, image_path

# Specifying coordinates and image size for an embeded image.
# x and y values define the position of the image on the slide.
# cx and cy define the width and height of the image.
# x, y, cx, cy are in points. Each pixel is 12700 points.
# coordinates parameter is optional.
coords = {x: 124200, y: 3356451, cx: 2895600, cy: 1013460}
@deck.add_pictorial_slide title, image_path, coords

# Saving the pptx file to the current directory.
@deck.save('test.pptx')

关于javascript - 使用 Rails 创建 powerpoint 演示文稿,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13406767/

相关文章:

javascript - 如何将简单的ID(jquery ajax)发布到asp.net mvc中的Action方法

javascript - 如何让图像仅在视口(viewport)中延迟加载?

ruby-on-rails - Ruby:什么时候用 self 什么时候不用?

ruby-on-rails - Rails 中的排序/随机化/转换数组

ruby - 如何将方法动态定义为私有(private)?

c# - 检测移动浏览器对 HTML5 支持的代码

javascript - 无法从对象数组中选择第一个对象

ruby-on-rails - Rspec 的 instance_double 创建间歇性规范失败

javascript - 如何使用 PhantomJs 从网页中截取 googlemap 的屏幕截图?

mysql - 如何对数百万行运行这个复杂的查询