43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
# File 'lib/asposeslidesjava/Shapes/formatlines.rb', line 43
def format_join_styles()
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/Shapes/'
pres = Rjb::import('com.aspose.slides.Presentation').new
sld = pres.getSlides().get_Item(0)
shape_type = Rjb::import('com.aspose.slides.ShapeType')
shp1 = sld.getShapes().addAutoShape(shape_type.Rectangle, 50, 100, 150, 75)
shp2 = sld.getShapes().addAutoShape(shape_type.Rectangle, 300, 100, 150, 75)
shp3 = sld.getShapes().addAutoShape(shape_type.Rectangle, 50, 250, 150, 75)
fill_type = Rjb::import('com.aspose.slides.FillType')
color = Rjb::import('java.awt.Color')
shp1.getFillFormat().setFillType(fill_type.Solid)
shp1.getFillFormat().getSolidFillColor().setColor(color.BLACK)
shp2.getFillFormat().setFillType(fill_type.Solid)
shp2.getFillFormat().getSolidFillColor().setColor(color.BLACK)
shp3.getFillFormat().setFillType(fill_type.Solid)
shp3.getFillFormat().getSolidFillColor().setColor(color.BLACK)
shp1.getLineFormat().setWidth(15)
shp2.getLineFormat().setWidth(15)
shp3.getLineFormat().setWidth (15)
shp1.getLineFormat().getFillFormat().setFillType(fill_type.Solid)
shp1.getLineFormat().getFillFormat().getSolidFillColor().setColor(color.BLUE)
shp2.getLineFormat().getFillFormat().setFillType(fill_type.Solid)
shp2.getLineFormat().getFillFormat().getSolidFillColor().setColor(color.BLUE)
shp3.getLineFormat().getFillFormat().setFillType(fill_type.Solid)
shp3.getLineFormat().getFillFormat().getSolidFillColor().setColor(color.BLUE)
line_join_style = Rjb::import('com.aspose.slides.LineJoinStyle')
shp1.getLineFormat().setJoinStyle(line_join_style.Miter)
shp2.getLineFormat().setJoinStyle(line_join_style.Bevel)
shp3.getLineFormat().setJoinStyle(line_join_style.Round)
shp1.getTextFrame().setText ("This is Miter Join Style")
shp2.getTextFrame().setText( "This is Bevel Join Style")
shp3.getTextFrame().setText ("This is Round Join Style")
save_format = Rjb::import('com.aspose.slides.SaveFormat')
pres.save(data_dir + "RectShpLnJoin.pptx", save_format.Pptx)
puts "Formatted join styles, please check the output file."
end
|