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
|
# File 'lib/asposeslidesjava/Text/exporttexttohtml.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(data_dir + 'input.pptx')
slide= pres.getSlides().get_Item(0)
index = 0
ashape = slide.getShapes().get_Item(index)
os = Rjb::import('java.io.FileOutputStream').new(data_dir + "export.html")
writer = Rjb::import('java.io.OutputStreamWriter').new(os,"UTF-8")
writer.write(ashape.getTextFrame().getParagraphs().exportToHtml(0, ashape.getTextFrame().getParagraphs().getCount(), nil))
writer.close()
puts "Export text to html, please check the output file."
end
|