8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/asposeslidesjava/Charts/chartlegend.rb', line 8
def set_location_and_size()
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
pres = Rjb::import('com.aspose.slides.Presentation').new
slide = pres.getSlides().get_Item(0)
chart = slide.getShapes().addChart(Rjb::import('com.aspose.slides.ChartType').ClusteredColumn, 50, 50, 500, 500)
chart.getLegend().setX(50 / chart.getWidth())
chart.getLegend().setY (50 / chart.getHeight())
chart.getLegend().setWidth(100 / chart.getWidth())
chart.getLegend().setHeight(100 / chart.getHeight())
save_format = Rjb::import('com.aspose.slides.SaveFormat')
pres.save(data_dir + "Legend.pptx", save_format.Pptx)
puts "Set custom location and size of chart legend, please check the output file."
end
|