gpt4 book ai didi

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

转载 作者:数据小太阳 更新时间:2023-10-29 05:55:35 25 4
gpt4 key购买 nike

我处于这样一种情况,我必须以编程方式构建 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com