asposeslidesjava 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +3 -0
- data/LICENSE +21 -0
- data/README.md +31 -0
- data/Rakefile +2 -0
- data/asposeslidesjava.gemspec +27 -0
- data/config/aspose.yml +5 -0
- data/data/Aspose.html +55 -0
- data/data/Aspose.pptx +0 -0
- data/data/AsposeChart.pptx +0 -0
- data/data/Bass-Drum.wav +0 -0
- data/data/HelloWorld.pptx +0 -0
- data/data/Presentation1.ppt +0 -0
- data/data/Shapes/OleEmbed.pptx +0 -0
- data/data/Shapes/Wildlife.mp4 +0 -0
- data/data/Shapes/sample.xlsx +0 -0
- data/data/Source.odp +0 -0
- data/data/Tables/aspose-logo.jpg +0 -0
- data/data/Tables/demotable.pptx +0 -0
- data/data/Text/Welcome.pptx +0 -0
- data/data/Text/import.html +119 -0
- data/data/Text/input.pptx +0 -0
- data/data/Wildlife.mp4 +0 -0
- data/data/WithActiveX.pptm +0 -0
- data/data/aspose-logo.jpg +0 -0
- data/data/demo.pptx +0 -0
- data/data/night.jpg +0 -0
- data/data/vbamacro.pptx +0 -0
- data/lib/asposeslidesjava.rb +71 -0
- data/lib/asposeslidesjava/ActiveX/addactivex.rb +21 -0
- data/lib/asposeslidesjava/Charts/chartlegend.rb +33 -0
- data/lib/asposeslidesjava/Charts/chartproperties.rb +120 -0
- data/lib/asposeslidesjava/Charts/chartseries.rb +28 -0
- data/lib/asposeslidesjava/Charts/charttrendlines.rb +53 -0
- data/lib/asposeslidesjava/Charts/createchart.rb +163 -0
- data/lib/asposeslidesjava/Charts/errorbars.rb +84 -0
- data/lib/asposeslidesjava/Charts/existingchart.rb +66 -0
- data/lib/asposeslidesjava/Charts/formattingchartentities.rb +163 -0
- data/lib/asposeslidesjava/Charts/setlabeldistance.rb +24 -0
- data/lib/asposeslidesjava/Charts/setpiechartcolors.rb +118 -0
- data/lib/asposeslidesjava/Presentation/convertingtohtml.rb +25 -0
- data/lib/asposeslidesjava/Presentation/convertingtonotes.rb +37 -0
- data/lib/asposeslidesjava/Presentation/convertingtopdf.rb +16 -0
- data/lib/asposeslidesjava/Presentation/convertingtotiff.rb +62 -0
- data/lib/asposeslidesjava/Presentation/convertingtoxps.rb +43 -0
- data/lib/asposeslidesjava/Presentation/odptopptx.rb +16 -0
- data/lib/asposeslidesjava/Presentation/ppttopptx.rb +16 -0
- data/lib/asposeslidesjava/Presentation/properties.rb +106 -0
- data/lib/asposeslidesjava/Presentation/zoom.rb +20 -0
- data/lib/asposeslidesjava/Shapes/addellipseshape.rb +60 -0
- data/lib/asposeslidesjava/Shapes/addinglineshape.rb +65 -0
- data/lib/asposeslidesjava/Shapes/addrectangleshape.rb +58 -0
- data/lib/asposeslidesjava/Shapes/cloneshape.rb +32 -0
- data/lib/asposeslidesjava/Shapes/connectshapes.rb +83 -0
- data/lib/asposeslidesjava/Shapes/embedvideo.rb +32 -0
- data/lib/asposeslidesjava/Shapes/fillingshapes.rb +98 -0
- data/lib/asposeslidesjava/Shapes/findshape.rb +30 -0
- data/lib/asposeslidesjava/Shapes/formatlines.rb +99 -0
- data/lib/asposeslidesjava/Shapes/frame.rb +85 -0
- data/lib/asposeslidesjava/Shapes/groupshape.rb +35 -0
- data/lib/asposeslidesjava/Shapes/oleobject.rb +26 -0
- data/lib/asposeslidesjava/Shapes/rotatingshapes.rb +25 -0
- data/lib/asposeslidesjava/Shapes/shapeproperties.rb +30 -0
- data/lib/asposeslidesjava/Shapes/shapethumbnail.rb +18 -0
- data/lib/asposeslidesjava/Slides/accessslides.rb +38 -0
- data/lib/asposeslidesjava/Slides/addslides.rb +28 -0
- data/lib/asposeslidesjava/Slides/background.rb +76 -0
- data/lib/asposeslidesjava/Slides/changingposition.rb +22 -0
- data/lib/asposeslidesjava/Slides/cloneslides.rb +72 -0
- data/lib/asposeslidesjava/Slides/creatingsvg.rb +27 -0
- data/lib/asposeslidesjava/Slides/hyperlinks.rb +19 -0
- data/lib/asposeslidesjava/Slides/removeslides.rb +46 -0
- data/lib/asposeslidesjava/Slides/sizeandlayout.rb +55 -0
- data/lib/asposeslidesjava/Slides/thumbnail.rb +113 -0
- data/lib/asposeslidesjava/Slides/transitions.rb +24 -0
- data/lib/asposeslidesjava/SmartArt/addsmartart.rb +26 -0
- data/lib/asposeslidesjava/SmartArt/fillformat.rb +28 -0
- data/lib/asposeslidesjava/Tables/addimage.rb +34 -0
- data/lib/asposeslidesjava/Tables/aligntext.rb +48 -0
- data/lib/asposeslidesjava/Tables/clonerowcolumn.rb +76 -0
- data/lib/asposeslidesjava/Tables/createtable.rb +61 -0
- data/lib/asposeslidesjava/Tables/removerowcolumn.rb +27 -0
- data/lib/asposeslidesjava/Text/createtextbox.rb +79 -0
- data/lib/asposeslidesjava/Text/exporttexttohtml.rb +30 -0
- data/lib/asposeslidesjava/Text/importhtml.rb +51 -0
- data/lib/asposeslidesjava/Text/managefont.rb +30 -0
- data/lib/asposeslidesjava/Text/managetext.rb +128 -0
- data/lib/asposeslidesjava/Text/paragraphs.rb +260 -0
- data/lib/asposeslidesjava/Text/replacetext.rb +23 -0
- data/lib/asposeslidesjava/Text/shadoweffects.rb +37 -0
- data/lib/asposeslidesjava/Text/textfont.rb +130 -0
- data/lib/asposeslidesjava/Text/wordart.rb +45 -0
- data/lib/asposeslidesjava/VBAMacros/removevbamacro.rb +18 -0
- data/lib/asposeslidesjava/activex.rb +1 -0
- data/lib/asposeslidesjava/asposeslides.rb +10 -0
- data/lib/asposeslidesjava/charts.rb +9 -0
- data/lib/asposeslidesjava/helloworld.rb +38 -0
- data/lib/asposeslidesjava/presentation.rb +9 -0
- data/lib/asposeslidesjava/shapes.rb +15 -0
- data/lib/asposeslidesjava/slides.rb +11 -0
- data/lib/asposeslidesjava/smartart.rb +2 -0
- data/lib/asposeslidesjava/tables.rb +5 -0
- data/lib/asposeslidesjava/text.rb +10 -0
- data/lib/asposeslidesjava/vbamacros.rb +1 -0
- data/lib/asposeslidesjava/version.rb +3 -0
- data/samples/test.rb +8 -0
- metadata +206 -0
@@ -0,0 +1,35 @@
|
|
1
|
+
module Asposeslidesjava
|
2
|
+
module GroupShape
|
3
|
+
def initialize()
|
4
|
+
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/Shapes/'
|
5
|
+
|
6
|
+
# Create an instance of Presentation class
|
7
|
+
pres = Rjb::import('com.aspose.slides.Presentation').new(data_dir + 'demo.pptx')
|
8
|
+
|
9
|
+
# Get the first slide
|
10
|
+
sld = pres.getSlides().get_Item(0)
|
11
|
+
|
12
|
+
# Accessing the shape collection of slides
|
13
|
+
slide_shapes = sld.getShapes()
|
14
|
+
|
15
|
+
# Adding a group shape to the slide
|
16
|
+
group_shape = slide_shapes.addGroupShape()
|
17
|
+
|
18
|
+
# Adding shapes inside Added group shape
|
19
|
+
shape_type = Rjb::import('com.aspose.slides.ShapeType')
|
20
|
+
group_shape.getShapes().addAutoShape(shape_type.Rectangle, 300, 100, 100, 100)
|
21
|
+
group_shape.getShapes().addAutoShape(shape_type.Rectangle, 500, 100, 100, 100)
|
22
|
+
group_shape.getShapes().addAutoShape(shape_type.Rectangle, 300, 300, 100, 100)
|
23
|
+
group_shape.getShapes().addAutoShape(shape_type.Rectangle, 500, 300, 100, 100)
|
24
|
+
|
25
|
+
# Adding group shape frame
|
26
|
+
group_shape.setFrame(Rjb::import('com.aspose.slides.ShapeFrame').new(100, 300, 500, 40, Rjb::import('com.aspose.slides.NullableBool').False, Rjb::import('com.aspose.slides.NullableBool').False, 0))
|
27
|
+
|
28
|
+
# Write the presentation as a PPTX file
|
29
|
+
save_format = Rjb::import('com.aspose.slides.SaveFormat')
|
30
|
+
pres.save(data_dir + "GroupShape.pptx", save_format.Pptx)
|
31
|
+
|
32
|
+
puts "Added group shape, please check the output file."
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Asposeslidesjava
|
2
|
+
module OleObject
|
3
|
+
def initialize()
|
4
|
+
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/Shapes/'
|
5
|
+
|
6
|
+
# Create an instance of Presentation class
|
7
|
+
pres = Rjb::import('com.aspose.slides.Presentation').new(data_dir + 'OleEmbed.pptx')
|
8
|
+
|
9
|
+
# Get the first slide
|
10
|
+
sld = pres.getSlides().get_Item(0)
|
11
|
+
|
12
|
+
# Cast the shape to OleObjectFrameEx
|
13
|
+
oof = sld.getShapes().get_Item(0)
|
14
|
+
|
15
|
+
# Read the OLE Object and write it to disk
|
16
|
+
if oof != nil
|
17
|
+
fstr = Rjb::import('java.io.FileOutputStream').new(data_dir + "excelFromOLEObject.xlsx")
|
18
|
+
buf = oof.getObjectData()
|
19
|
+
fstr.write(buf, 0, buf.length)
|
20
|
+
fstr.flush()
|
21
|
+
fstr.close()
|
22
|
+
puts "Excel OLE Object written as excelFromOLEObject.xlsx file"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Asposeslidesjava
|
2
|
+
module RotatingShapes
|
3
|
+
def initialize()
|
4
|
+
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/Shapes/'
|
5
|
+
|
6
|
+
# Create an instance of Presentation class
|
7
|
+
pres = Rjb::import('com.aspose.slides.Presentation').new
|
8
|
+
|
9
|
+
# Get the first slide
|
10
|
+
sld = pres.getSlides().get_Item(0)
|
11
|
+
|
12
|
+
# Add autoshape of rectangle type
|
13
|
+
shp = sld.getShapes().addAutoShape(Rjb::import('com.aspose.slides.ShapeType').Rectangle, 50, 150, 75, 150)
|
14
|
+
|
15
|
+
# Rotate the shape to 90 degree
|
16
|
+
shp.setRotation(90)
|
17
|
+
|
18
|
+
# Write the presentation as a PPTX file
|
19
|
+
save_format = Rjb::import('com.aspose.slides.SaveFormat')
|
20
|
+
pres.save(data_dir + "RectShpRot.pptx", save_format.Pptx)
|
21
|
+
|
22
|
+
puts "Rotated shape, please check the output file."
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Asposeslidesjava
|
2
|
+
module ShapeProperties
|
3
|
+
def initialize()
|
4
|
+
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/Shapes/'
|
5
|
+
|
6
|
+
# Create an instance of Presentation class
|
7
|
+
pres = Rjb::import('com.aspose.slides.Presentation').new
|
8
|
+
|
9
|
+
slide = pres.getSlides().get_Item(0)
|
10
|
+
|
11
|
+
shp3 = slide.getShapes().addAutoShape(Rjb::import('com.aspose.slides.ShapeType').Rectangle, 200, 365, 400, 150)
|
12
|
+
shp3.getFillFormat().setFillType(Rjb::import('com.aspose.slides.FillType').NoFill)
|
13
|
+
shp3.addTextFrame(" ")
|
14
|
+
|
15
|
+
txt_frame = shp3.getTextFrame()
|
16
|
+
para = txt_frame.getParagraphs().get_Item(0)
|
17
|
+
portion = para.getPortions().get_Item(0)
|
18
|
+
portion.setText("Watermark Text Watermark Text Watermark Text")
|
19
|
+
|
20
|
+
shp3 = slide.getShapes().addAutoShape(Rjb::import('com.aspose.slides.ShapeType').Triangle, 200, 365, 400, 150)
|
21
|
+
slide.getShapes().reorder(1, shp3)
|
22
|
+
|
23
|
+
# Write the presentation as a PPTX file
|
24
|
+
save_format = Rjb::import('com.aspose.slides.SaveFormat')
|
25
|
+
pres.save(data_dir + "ChangeShapesOrder.pptx", save_format.Pptx)
|
26
|
+
|
27
|
+
puts "Changed shapes order, please check the output file."
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Asposeslidesjava
|
2
|
+
module ShapeThumbnail
|
3
|
+
def initialize()
|
4
|
+
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/Shapes/'
|
5
|
+
|
6
|
+
# Create an instance of Presentation class
|
7
|
+
pres = Rjb::import('com.aspose.slides.Presentation').new(data_dir + 'demo.pptx')
|
8
|
+
|
9
|
+
# Create a full scale image
|
10
|
+
image = pres.getSlides().get_Item(0).getShapes().get_Item(0).getThumbnail()
|
11
|
+
|
12
|
+
# Save the image to disk in PNG format
|
13
|
+
Rjb::import('javax.imageio.ImageIO').write(image,"jpeg",Rjb::import('java.io.File').new(data_dir + "ShapeThumbnail.jpg"))
|
14
|
+
|
15
|
+
puts "Generated shape Thumbnail from a slide, please check the output file."
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module Asposeslidesjava
|
2
|
+
module AccessSlides
|
3
|
+
def initialize()
|
4
|
+
# Using Slides Collection to Access Slide by Index
|
5
|
+
get_slide_by_index()
|
6
|
+
|
7
|
+
# Using Slides Collection to Access Slide by ID
|
8
|
+
get_slide_by_id()
|
9
|
+
end
|
10
|
+
|
11
|
+
def get_slide_by_index()
|
12
|
+
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
|
13
|
+
|
14
|
+
# Instantiate Presentation class that represents the presentation file
|
15
|
+
pres = Rjb::import('com.aspose.slides.Presentation').new(data_dir + 'Aspose.pptx')
|
16
|
+
|
17
|
+
# Accessing a slide using its slide index
|
18
|
+
slide = pres.getSlides().get_Item(0)
|
19
|
+
|
20
|
+
puts "Slide: " + slide.to_string
|
21
|
+
end
|
22
|
+
|
23
|
+
def get_slide_by_id()
|
24
|
+
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
|
25
|
+
|
26
|
+
# Instantiate Presentation class that represents the presentation file
|
27
|
+
pres = Rjb::import('com.aspose.slides.Presentation').new(data_dir + 'Aspose.pptx')
|
28
|
+
|
29
|
+
# Getting Slide ID
|
30
|
+
id = pres.getSlides().get_Item(0).getSlideId()
|
31
|
+
|
32
|
+
# Accessing Slide by ID
|
33
|
+
slide = pres.getSlideById(id)
|
34
|
+
|
35
|
+
puts "Slide: " + slide.to_string
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Asposeslidesjava
|
2
|
+
module AddSlides
|
3
|
+
def initialize()
|
4
|
+
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
|
5
|
+
|
6
|
+
# Instantiate Presentation class that represents the presentation file
|
7
|
+
pres = Rjb::import('com.aspose.slides.Presentation').new
|
8
|
+
|
9
|
+
# Instantiate SlideCollection calss
|
10
|
+
slides = pres.getSlides()
|
11
|
+
|
12
|
+
i = 0
|
13
|
+
while i < pres.getLayoutSlides().size()
|
14
|
+
# Add an empty slide to the Slides collection
|
15
|
+
slides.addEmptySlide(pres.getLayoutSlides().get_Item(i))
|
16
|
+
i +=1
|
17
|
+
end
|
18
|
+
|
19
|
+
#Do some work on the newly added slide
|
20
|
+
|
21
|
+
# Saving the presentation
|
22
|
+
save_format = Rjb::import('com.aspose.slides.SaveFormat')
|
23
|
+
pres.save(data_dir + "EmptySlide.pptx", save_format.Pptx)
|
24
|
+
|
25
|
+
puts "Document has been created, please check the output file."
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
module Asposeslidesjava
|
2
|
+
module Background
|
3
|
+
def initialize()
|
4
|
+
# Setting the Background Color of a Master Slide
|
5
|
+
set_background_color_of_master_slide()
|
6
|
+
|
7
|
+
# Setting the Background Color of a Normal Slide
|
8
|
+
set_background_color_of_normal_slide()
|
9
|
+
|
10
|
+
# Setting the Slide Background to an Image
|
11
|
+
set_image_as_background_color()
|
12
|
+
end
|
13
|
+
|
14
|
+
def set_background_color_of_master_slide()
|
15
|
+
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
|
16
|
+
|
17
|
+
# Instantiate Presentation class that represents the presentation file
|
18
|
+
pres = Rjb::import('com.aspose.slides.Presentation').new
|
19
|
+
|
20
|
+
# Set the background color of the Master Slide to Forest Green
|
21
|
+
pres.getMasters().get_Item(0).getBackground().setType(Rjb::import('com.aspose.slides.BackgroundType').OwnBackground)
|
22
|
+
pres.getMasters().get_Item(0).getBackground().getFillFormat().setFillType(Rjb::import('com.aspose.slides.FillType').Solid)
|
23
|
+
pres.getMasters().get_Item(0).getBackground().getFillFormat().getSolidFillColor().setColor(Rjb::import('java.awt.Color').GREEN)
|
24
|
+
|
25
|
+
# Saving the presentation
|
26
|
+
save_format = Rjb::import('com.aspose.slides.SaveFormat')
|
27
|
+
pres.save(data_dir + "MasterBG.pptx", save_format.Pptx)
|
28
|
+
|
29
|
+
puts "Set background color of master slide, please check the output file."
|
30
|
+
end
|
31
|
+
|
32
|
+
def set_background_color_of_normal_slide()
|
33
|
+
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
|
34
|
+
|
35
|
+
# Instantiate Presentation class that represents the presentation file
|
36
|
+
pres = Rjb::import('com.aspose.slides.Presentation').new
|
37
|
+
|
38
|
+
# Set the background color of the Normal slide to Blue
|
39
|
+
pres.getSlides().get_Item(0).getBackground().setType(Rjb::import('com.aspose.slides.BackgroundType').OwnBackground)
|
40
|
+
pres.getSlides().get_Item(0).getBackground().getFillFormat().setFillType(Rjb::import('com.aspose.slides.FillType').Solid)
|
41
|
+
pres.getSlides().get_Item(0).getBackground().getFillFormat().getSolidFillColor().setColor(Rjb::import('java.awt.Color').BLUE)
|
42
|
+
|
43
|
+
# Saving the presentation
|
44
|
+
save_format = Rjb::import('com.aspose.slides.SaveFormat')
|
45
|
+
pres.save(data_dir + "ContentBG.pptx", save_format.Pptx)
|
46
|
+
|
47
|
+
puts "Set background color of normal slide, please check the output file."
|
48
|
+
end
|
49
|
+
|
50
|
+
def set_image_as_background_color()
|
51
|
+
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
|
52
|
+
|
53
|
+
# Instantiate Presentation class that represents the presentation file
|
54
|
+
pres = Rjb::import('com.aspose.slides.Presentation').new
|
55
|
+
|
56
|
+
# Set the background with Image
|
57
|
+
pres.getSlides().get_Item(0).getBackground().setType(Rjb::import('com.aspose.slides.BackgroundType').OwnBackground)
|
58
|
+
pres.getSlides().get_Item(0).getBackground().getFillFormat().setFillType(Rjb::import('com.aspose.slides.FillType').Picture)
|
59
|
+
pres.getSlides().get_Item(0).getBackground().getFillFormat().getPictureFillFormat().setPictureFillMode(Rjb::import('com.aspose.slides.PictureFillMode').Stretch)
|
60
|
+
|
61
|
+
# Set the picture
|
62
|
+
imgx = pres.getImages().addImage(Rjb::import('java.io.FileInputStream').new(Rjb::import('java.io.File').new(data_dir + 'night.jpg')))
|
63
|
+
|
64
|
+
# Image imgx = pres.getImages().addImage(image);
|
65
|
+
# Add image to presentation's images collection
|
66
|
+
|
67
|
+
pres.getSlides().get_Item(0).getBackground().getFillFormat().getPictureFillFormat().getPicture().setImage(imgx)
|
68
|
+
|
69
|
+
# Saving the presentation
|
70
|
+
save_format = Rjb::import('com.aspose.slides.SaveFormat')
|
71
|
+
pres.save(data_dir + "ContentBG_Image.pptx", save_format.Pptx)
|
72
|
+
|
73
|
+
puts "Set image as background, please check the output file."
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Asposeslidesjava
|
2
|
+
module ChangingPosition
|
3
|
+
def initialize()
|
4
|
+
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
|
5
|
+
|
6
|
+
# Instantiate Presentation class that represents the presentation file
|
7
|
+
pres = Rjb::import('com.aspose.slides.Presentation').new(data_dir + 'Aspose.pptx')
|
8
|
+
|
9
|
+
# Get the slide whose position is to be changed
|
10
|
+
slide = pres.getSlides().get_Item(0)
|
11
|
+
|
12
|
+
# Set the new position for the slide
|
13
|
+
slide.setSlideNumber(2)
|
14
|
+
|
15
|
+
# Saving the presentation
|
16
|
+
save_format = Rjb::import('com.aspose.slides.SaveFormat')
|
17
|
+
pres.save(data_dir + "Aspose_Position.pptx", save_format.Pptx)
|
18
|
+
|
19
|
+
puts "Changes slide position, please check the output file."
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
module Asposeslidesjava
|
2
|
+
module CloneSlides
|
3
|
+
def initialize()
|
4
|
+
# Within the Same Presentation from One Position to the End
|
5
|
+
clone_to_end_of_presentation()
|
6
|
+
|
7
|
+
# From One Position to Anther within the Same Presentation
|
8
|
+
clone_to_aonther_position()
|
9
|
+
|
10
|
+
# In Another Presentation at the End of the Existing Slides
|
11
|
+
clone_to_other_presentation_at_end_of_existing_slide()
|
12
|
+
end
|
13
|
+
|
14
|
+
def clone_to_end_of_presentation()
|
15
|
+
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
|
16
|
+
|
17
|
+
# Instantiate Presentation class that represents the presentation file
|
18
|
+
pres = Rjb::import('com.aspose.slides.Presentation').new(data_dir + 'Aspose.pptx')
|
19
|
+
|
20
|
+
# Clone the desired slide to the end of the collection of slides in the same presentation
|
21
|
+
slides = pres.getSlides()
|
22
|
+
slides.addClone(pres.getSlides().get_Item(0))
|
23
|
+
|
24
|
+
# Saving the presentation file
|
25
|
+
save_format = Rjb::import('com.aspose.slides.SaveFormat')
|
26
|
+
pres.save(data_dir + "Aspose_Cloned.pptx", save_format.Pptx)
|
27
|
+
|
28
|
+
puts "Slide has been cloned, please check the output file."
|
29
|
+
end
|
30
|
+
|
31
|
+
def clone_to_aonther_position()
|
32
|
+
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
|
33
|
+
|
34
|
+
# Instantiate Presentation class that represents the presentation file
|
35
|
+
pres = Rjb::import('com.aspose.slides.Presentation').new(data_dir + 'Aspose.pptx')
|
36
|
+
|
37
|
+
# Clone the desired slide to the end of the collection of slides in the same presentation
|
38
|
+
slides = pres.getSlides()
|
39
|
+
|
40
|
+
# Clone the desired slide to the specified index in the same presentation
|
41
|
+
slides.insertClone(2, pres.getSlides().get_Item(1))
|
42
|
+
|
43
|
+
# Saving the presentation file
|
44
|
+
save_format = Rjb::import('com.aspose.slides.SaveFormat')
|
45
|
+
pres.save(data_dir + "Aspose_Cloned.pptx", save_format.Pptx)
|
46
|
+
|
47
|
+
puts "Slide has been cloned, please check the output file."
|
48
|
+
end
|
49
|
+
|
50
|
+
# In Another Presentation at the End of the Existing Slides
|
51
|
+
def clone_to_other_presentation_at_end_of_existing_slide()
|
52
|
+
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
|
53
|
+
|
54
|
+
# Instantiate Presentation class that represents the presentation file
|
55
|
+
src_pres = Rjb::import('com.aspose.slides.Presentation').new(data_dir + 'Aspose.pptx')
|
56
|
+
|
57
|
+
# Instantiate Presentation class for destination PPTX (where slide is to be cloned)
|
58
|
+
dest_pres = Rjb::import('com.aspose.slides.Presentation').new
|
59
|
+
|
60
|
+
# Clone the desired slide from the source presentation to the end of the collection of slides in destination presentation
|
61
|
+
slds = dest_pres.getSlides()
|
62
|
+
|
63
|
+
slds.addClone(src_pres.getSlides().get_Item(0))
|
64
|
+
|
65
|
+
# Saving the presentation file
|
66
|
+
save_format = Rjb::import('com.aspose.slides.SaveFormat')
|
67
|
+
dest_pres.save(data_dir + "Aspose_dest2.pptx", save_format.Pptx)
|
68
|
+
|
69
|
+
puts "Slide has been cloned, please check the output file."
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Asposeslidesjava
|
2
|
+
module CreatingSvg
|
3
|
+
def initialize()
|
4
|
+
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
|
5
|
+
|
6
|
+
# Instantiate Presentation class that represents the presentation file
|
7
|
+
pres = Rjb::import('com.aspose.slides.Presentation').new(data_dir + 'demo.pptx')
|
8
|
+
|
9
|
+
# Getting last slide index
|
10
|
+
last_slide_position = pres.getSlides().size()
|
11
|
+
|
12
|
+
#Iterating through every presentation slide and generating SVG image
|
13
|
+
i = 0
|
14
|
+
while i < last_slide_position
|
15
|
+
# Accessing Slides
|
16
|
+
slide = pres.getSlides().get_Item(i)
|
17
|
+
|
18
|
+
# Getting and saving the slide SVG image
|
19
|
+
slide.writeAsSvg(Rjb::import('java.io.FileOutputStream').new(data_dir + "SvgImage#{i}.svg"))
|
20
|
+
|
21
|
+
i +=1
|
22
|
+
end
|
23
|
+
|
24
|
+
puts "Created SVG images, please check output files."
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Asposeslidesjava
|
2
|
+
module Hyperlinks
|
3
|
+
def initialize()
|
4
|
+
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
|
5
|
+
|
6
|
+
# Instantiate Presentation class that represents the presentation file
|
7
|
+
pres = Rjb::import('com.aspose.slides.Presentation').new(data_dir + 'demo.pptx')
|
8
|
+
|
9
|
+
# Removing the hyperlinks from presentation
|
10
|
+
pres.getHyperlinkQueries().removeAllHyperlinks()
|
11
|
+
|
12
|
+
# Saving the presentation
|
13
|
+
save_format = Rjb::import('com.aspose.slides.SaveFormat')
|
14
|
+
pres.save(data_dir + "Hyperlinks.pptx", save_format.Pptx)
|
15
|
+
|
16
|
+
puts "Removed hyperlinks successfully, please check the output file."
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module Asposeslidesjava
|
2
|
+
module RemoveSlides
|
3
|
+
def initialize()
|
4
|
+
# Using Slides Collection to Remove Slide by Index
|
5
|
+
remove_slide_by_index()
|
6
|
+
|
7
|
+
# Using Slides Collection to Remove Slide by ID
|
8
|
+
remove_slide_by_id()
|
9
|
+
end
|
10
|
+
|
11
|
+
def remove_slide_by_index()
|
12
|
+
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
|
13
|
+
|
14
|
+
# Instantiate Presentation class that represents the presentation file
|
15
|
+
pres = Rjb::import('com.aspose.slides.Presentation').new(data_dir + 'Aspose.pptx')
|
16
|
+
|
17
|
+
# Accessing a slide using its slide index
|
18
|
+
slide = pres.getSlides().get_Item(0)
|
19
|
+
|
20
|
+
# Removing a slide using its reference
|
21
|
+
pres.getSlides().remove(slide)
|
22
|
+
|
23
|
+
# Saving the presentation file
|
24
|
+
save_format = Rjb::import('com.aspose.slides.SaveFormat')
|
25
|
+
pres.save(data_dir + "Modified.pptx", save_format.Pptx)
|
26
|
+
|
27
|
+
puts "Document has been created, please check the output file."
|
28
|
+
end
|
29
|
+
|
30
|
+
def remove_slide_by_id()
|
31
|
+
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
|
32
|
+
|
33
|
+
# Instantiate Presentation class that represents the presentation file
|
34
|
+
pres = Rjb::import('com.aspose.slides.Presentation').new(data_dir + 'Aspose.pptx')
|
35
|
+
|
36
|
+
# Removing a slide using its slide index
|
37
|
+
pres.getSlides().removeAt(1)
|
38
|
+
|
39
|
+
# Saving the presentation file
|
40
|
+
save_format = Rjb::import('com.aspose.slides.SaveFormat')
|
41
|
+
pres.save(data_dir + "Modified.pptx", save_format.Pptx)
|
42
|
+
|
43
|
+
puts "Removed slide by ID, please check the output file."
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|