3
4
5
6
7
8
9
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
|
# File 'lib/asposeslidesjava/Text/importhtml.rb', line 3
def initialize()
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/Text/'
pres = Rjb::import('com.aspose.slides.Presentation').new
slide = pres.getSlides().get_Item(0)
ashape = slide.getShapes().addAutoShape(Rjb::import('com.aspose.slides.ShapeType').Rectangle, 10, 10, pres.getSlideSize().getSize().getWidth(), pres.getSlideSize().getSize().getHeight())
ashape.getFillFormat().setFillType(Rjb::import('com.aspose.slides.FillType').NoFill)
ashape.addTextFrame("")
ashape.getTextFrame().getParagraphs().clear()
input_stream = Rjb::import('java.io.FileInputStream').new(data_dir + "import.html")
reader = Rjb::import('java.io.InputStreamReader').new(input_stream)
data = reader.read()
content = read_file(data_dir + "import.html")
ashape.getTextFrame().getParagraphs().addFromHtml(content)
pres.save(data_dir + "output.pptx", Rjb::import('com.aspose.slides.SaveFormat').Pptx)
puts "Done with html import, please check the output file."
end
|