asposeslidesjava 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +3 -0
  3. data/LICENSE +21 -0
  4. data/README.md +31 -0
  5. data/Rakefile +2 -0
  6. data/asposeslidesjava.gemspec +27 -0
  7. data/config/aspose.yml +5 -0
  8. data/data/Aspose.html +55 -0
  9. data/data/Aspose.pptx +0 -0
  10. data/data/AsposeChart.pptx +0 -0
  11. data/data/Bass-Drum.wav +0 -0
  12. data/data/HelloWorld.pptx +0 -0
  13. data/data/Presentation1.ppt +0 -0
  14. data/data/Shapes/OleEmbed.pptx +0 -0
  15. data/data/Shapes/Wildlife.mp4 +0 -0
  16. data/data/Shapes/sample.xlsx +0 -0
  17. data/data/Source.odp +0 -0
  18. data/data/Tables/aspose-logo.jpg +0 -0
  19. data/data/Tables/demotable.pptx +0 -0
  20. data/data/Text/Welcome.pptx +0 -0
  21. data/data/Text/import.html +119 -0
  22. data/data/Text/input.pptx +0 -0
  23. data/data/Wildlife.mp4 +0 -0
  24. data/data/WithActiveX.pptm +0 -0
  25. data/data/aspose-logo.jpg +0 -0
  26. data/data/demo.pptx +0 -0
  27. data/data/night.jpg +0 -0
  28. data/data/vbamacro.pptx +0 -0
  29. data/lib/asposeslidesjava.rb +71 -0
  30. data/lib/asposeslidesjava/ActiveX/addactivex.rb +21 -0
  31. data/lib/asposeslidesjava/Charts/chartlegend.rb +33 -0
  32. data/lib/asposeslidesjava/Charts/chartproperties.rb +120 -0
  33. data/lib/asposeslidesjava/Charts/chartseries.rb +28 -0
  34. data/lib/asposeslidesjava/Charts/charttrendlines.rb +53 -0
  35. data/lib/asposeslidesjava/Charts/createchart.rb +163 -0
  36. data/lib/asposeslidesjava/Charts/errorbars.rb +84 -0
  37. data/lib/asposeslidesjava/Charts/existingchart.rb +66 -0
  38. data/lib/asposeslidesjava/Charts/formattingchartentities.rb +163 -0
  39. data/lib/asposeslidesjava/Charts/setlabeldistance.rb +24 -0
  40. data/lib/asposeslidesjava/Charts/setpiechartcolors.rb +118 -0
  41. data/lib/asposeslidesjava/Presentation/convertingtohtml.rb +25 -0
  42. data/lib/asposeslidesjava/Presentation/convertingtonotes.rb +37 -0
  43. data/lib/asposeslidesjava/Presentation/convertingtopdf.rb +16 -0
  44. data/lib/asposeslidesjava/Presentation/convertingtotiff.rb +62 -0
  45. data/lib/asposeslidesjava/Presentation/convertingtoxps.rb +43 -0
  46. data/lib/asposeslidesjava/Presentation/odptopptx.rb +16 -0
  47. data/lib/asposeslidesjava/Presentation/ppttopptx.rb +16 -0
  48. data/lib/asposeslidesjava/Presentation/properties.rb +106 -0
  49. data/lib/asposeslidesjava/Presentation/zoom.rb +20 -0
  50. data/lib/asposeslidesjava/Shapes/addellipseshape.rb +60 -0
  51. data/lib/asposeslidesjava/Shapes/addinglineshape.rb +65 -0
  52. data/lib/asposeslidesjava/Shapes/addrectangleshape.rb +58 -0
  53. data/lib/asposeslidesjava/Shapes/cloneshape.rb +32 -0
  54. data/lib/asposeslidesjava/Shapes/connectshapes.rb +83 -0
  55. data/lib/asposeslidesjava/Shapes/embedvideo.rb +32 -0
  56. data/lib/asposeslidesjava/Shapes/fillingshapes.rb +98 -0
  57. data/lib/asposeslidesjava/Shapes/findshape.rb +30 -0
  58. data/lib/asposeslidesjava/Shapes/formatlines.rb +99 -0
  59. data/lib/asposeslidesjava/Shapes/frame.rb +85 -0
  60. data/lib/asposeslidesjava/Shapes/groupshape.rb +35 -0
  61. data/lib/asposeslidesjava/Shapes/oleobject.rb +26 -0
  62. data/lib/asposeslidesjava/Shapes/rotatingshapes.rb +25 -0
  63. data/lib/asposeslidesjava/Shapes/shapeproperties.rb +30 -0
  64. data/lib/asposeslidesjava/Shapes/shapethumbnail.rb +18 -0
  65. data/lib/asposeslidesjava/Slides/accessslides.rb +38 -0
  66. data/lib/asposeslidesjava/Slides/addslides.rb +28 -0
  67. data/lib/asposeslidesjava/Slides/background.rb +76 -0
  68. data/lib/asposeslidesjava/Slides/changingposition.rb +22 -0
  69. data/lib/asposeslidesjava/Slides/cloneslides.rb +72 -0
  70. data/lib/asposeslidesjava/Slides/creatingsvg.rb +27 -0
  71. data/lib/asposeslidesjava/Slides/hyperlinks.rb +19 -0
  72. data/lib/asposeslidesjava/Slides/removeslides.rb +46 -0
  73. data/lib/asposeslidesjava/Slides/sizeandlayout.rb +55 -0
  74. data/lib/asposeslidesjava/Slides/thumbnail.rb +113 -0
  75. data/lib/asposeslidesjava/Slides/transitions.rb +24 -0
  76. data/lib/asposeslidesjava/SmartArt/addsmartart.rb +26 -0
  77. data/lib/asposeslidesjava/SmartArt/fillformat.rb +28 -0
  78. data/lib/asposeslidesjava/Tables/addimage.rb +34 -0
  79. data/lib/asposeslidesjava/Tables/aligntext.rb +48 -0
  80. data/lib/asposeslidesjava/Tables/clonerowcolumn.rb +76 -0
  81. data/lib/asposeslidesjava/Tables/createtable.rb +61 -0
  82. data/lib/asposeslidesjava/Tables/removerowcolumn.rb +27 -0
  83. data/lib/asposeslidesjava/Text/createtextbox.rb +79 -0
  84. data/lib/asposeslidesjava/Text/exporttexttohtml.rb +30 -0
  85. data/lib/asposeslidesjava/Text/importhtml.rb +51 -0
  86. data/lib/asposeslidesjava/Text/managefont.rb +30 -0
  87. data/lib/asposeslidesjava/Text/managetext.rb +128 -0
  88. data/lib/asposeslidesjava/Text/paragraphs.rb +260 -0
  89. data/lib/asposeslidesjava/Text/replacetext.rb +23 -0
  90. data/lib/asposeslidesjava/Text/shadoweffects.rb +37 -0
  91. data/lib/asposeslidesjava/Text/textfont.rb +130 -0
  92. data/lib/asposeslidesjava/Text/wordart.rb +45 -0
  93. data/lib/asposeslidesjava/VBAMacros/removevbamacro.rb +18 -0
  94. data/lib/asposeslidesjava/activex.rb +1 -0
  95. data/lib/asposeslidesjava/asposeslides.rb +10 -0
  96. data/lib/asposeslidesjava/charts.rb +9 -0
  97. data/lib/asposeslidesjava/helloworld.rb +38 -0
  98. data/lib/asposeslidesjava/presentation.rb +9 -0
  99. data/lib/asposeslidesjava/shapes.rb +15 -0
  100. data/lib/asposeslidesjava/slides.rb +11 -0
  101. data/lib/asposeslidesjava/smartart.rb +2 -0
  102. data/lib/asposeslidesjava/tables.rb +5 -0
  103. data/lib/asposeslidesjava/text.rb +10 -0
  104. data/lib/asposeslidesjava/vbamacros.rb +1 -0
  105. data/lib/asposeslidesjava/version.rb +3 -0
  106. data/samples/test.rb +8 -0
  107. metadata +206 -0
@@ -0,0 +1,66 @@
1
+ module Asposeslidesjava
2
+ module ExistingChart
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+ "AsposeChart.pptx")
8
+
9
+ # Access first slide
10
+ sld = pres.getSlides().get_Item(0)
11
+
12
+ # Add chart with default data
13
+ chart = sld.getShapes().get_Item(0)
14
+
15
+ # Setting the index of chart data sheet
16
+ defaultWorksheetIndex = 0
17
+
18
+ # Getting the chart data worksheet
19
+ fact = chart.getChartData().getChartDataWorkbook()
20
+
21
+ # Changing chart Category Name
22
+ fact.getCell(defaultWorksheetIndex, 1, 0, "Modified Category 1")
23
+ fact.getCell(defaultWorksheetIndex, 2, 0, "Modified Category 2")
24
+
25
+
26
+ # Take first chart series
27
+ series = chart.getChartData().getSeries().get_Item(0)
28
+
29
+ # Now updating series data
30
+ fact.getCell(defaultWorksheetIndex, 0, 1, "New_Series1") # modifying series name
31
+ series.getDataPoints().get_Item(0).getValue().setData(90)
32
+ series.getDataPoints().get_Item(1).getValue().setData(123)
33
+ series.getDataPoints().get_Item(2).getValue().setData(44)
34
+
35
+ # Take Second chart series
36
+ series = chart.getChartData().getSeries().get_Item(1)
37
+
38
+ # Now updating series data
39
+ fact.getCell(defaultWorksheetIndex, 0, 2, "New_Series2") #modifying series name
40
+ series.getDataPoints().get_Item(0).getValue().setData(23)
41
+ series.getDataPoints().get_Item(1).getValue().setData(67)
42
+ series.getDataPoints().get_Item(2).getValue().setData(99)
43
+
44
+
45
+ # Now, Adding a new series
46
+ chart.getChartData().getSeries().add(fact.getCell(defaultWorksheetIndex, 0, 3, "Series 3"), chart.getType())
47
+
48
+ # Take 3rd chart series
49
+ series = chart.getChartData().getSeries().get_Item(2)
50
+
51
+ # Now populating series data
52
+ series.getDataPoints().addDataPointForBarSeries(fact.getCell(defaultWorksheetIndex, 1, 3, 20))
53
+ series.getDataPoints().addDataPointForBarSeries(fact.getCell(defaultWorksheetIndex, 2, 3, 50))
54
+ series.getDataPoints().addDataPointForBarSeries(fact.getCell(defaultWorksheetIndex, 3, 3, 30))
55
+
56
+ chart.setType(Rjb::import('com.aspose.slides.ChartType').ClusteredCylinder)
57
+
58
+
59
+ # Saving the presentation to HTML format
60
+ save_format = Rjb::import('com.aspose.slides.SaveFormat')
61
+ pres.save(data_dir + "AsposeChartModified.pptx", save_format.Pptx)
62
+
63
+ puts "Updated chart, please check the output file."
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,163 @@
1
+ module Asposeslidesjava
2
+ module FormattingChartEntities
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
+ # Accessing the first slide
10
+ slide = pres.getSlides().get_Item(0)
11
+
12
+ # Adding the sample chart
13
+ chart = slide.getShapes().addChart(Rjb::import('com.aspose.slides.ChartType').LineWithMarkers, 50, 50, 500, 400)
14
+
15
+ # Setting Chart Titile
16
+ chart.hasTitle(true)
17
+ chart.getChartTitle().addTextFrameForOverriding("")
18
+ chartTitle = chart.getChartTitle().getTextFrameForOverriding().getParagraphs().get_Item(0).getPortions().get_Item(0)
19
+ chartTitle.setText("Sample Chart")
20
+ chartTitle.getPortionFormat().getFillFormat().setFillType(Rjb::import('com.aspose.slides.FillType').Solid)
21
+ chartTitle.getPortionFormat().getFillFormat().getSolidFillColor().setColor(Rjb::import('java.awt.Color').GRAY)
22
+ chartTitle.getPortionFormat().setFontHeight (20)
23
+ chartTitle.getPortionFormat().setFontBold(Rjb::import('com.aspose.slides.NullableBool').True)
24
+ chartTitle.getPortionFormat().setFontItalic(Rjb::import('com.aspose.slides.NullableBool').True)
25
+
26
+ # Setting Major grid lines format for value axis
27
+ chart.getAxes().getVerticalAxis().getMajorGridLinesFormat().getLine().getFillFormat().setFillType(Rjb::import('com.aspose.slides.FillType').Solid)
28
+ chart.getAxes().getVerticalAxis().getMajorGridLinesFormat().getLine().getFillFormat().getSolidFillColor().setColor(Rjb::import('java.awt.Color').BLUE)
29
+ chart.getAxes().getVerticalAxis().getMajorGridLinesFormat().getLine().setWidth(5)
30
+ chart.getAxes().getVerticalAxis().getMajorGridLinesFormat().getLine().setDashStyle(Rjb::import('com.aspose.slides.LineDashStyle').DashDot)
31
+
32
+ # Setting Minor grid lines format for value axis
33
+ chart.getAxes().getVerticalAxis().getMinorGridLinesFormat().getLine().getFillFormat().setFillType(Rjb::import('com.aspose.slides.FillType').Solid)
34
+ chart.getAxes().getVerticalAxis().getMinorGridLinesFormat().getLine().getFillFormat().getSolidFillColor().setColor(Rjb::import('java.awt.Color').RED)
35
+ chart.getAxes().getVerticalAxis().getMinorGridLinesFormat().getLine().setWidth(3)
36
+
37
+ # Setting value axis number format
38
+ chart.getAxes().getVerticalAxis().isNumberFormatLinkedToSource(false)
39
+ chart.getAxes().getVerticalAxis().setDisplayUnit(Rjb::import('com.aspose.slides.DisplayUnitType').Thousands)
40
+ chart.getAxes().getVerticalAxis().setNumberFormat("0.0%")
41
+
42
+ # Setting chart maximum, minimum values
43
+ chart.getAxes().getVerticalAxis().isAutomaticMajorUnit(false)
44
+ chart.getAxes().getVerticalAxis().isAutomaticMaxValue(false)
45
+ chart.getAxes().getVerticalAxis().isAutomaticMinorUnit(false)
46
+ chart.getAxes().getVerticalAxis().isAutomaticMinValue(false)
47
+
48
+ chart.getAxes().getVerticalAxis().setMaxValue(15)
49
+ chart.getAxes().getVerticalAxis().setMinValue(-2)
50
+ chart.getAxes().getVerticalAxis().setMinorUnit(0.5)
51
+ chart.getAxes().getVerticalAxis().setMajorUnit(2.0)
52
+
53
+ # Setting Value Axis Text Properties
54
+ txtVal = chart.getAxes().getVerticalAxis().getTextFormat().getPortionFormat()
55
+ txtVal.setFontBold(Rjb::import('com.aspose.slides.NullableBool').True)
56
+ txtVal.setFontHeight(16)
57
+ txtVal.setFontItalic(Rjb::import('com.aspose.slides.NullableBool').True)
58
+ txtVal.getFillFormat().setFillType(Rjb::import('com.aspose.slides.FillType').Solid)
59
+ txtVal.getFillFormat().getSolidFillColor().setColor(Rjb::import('java.awt.Color').new(Rjb::import('com.aspose.slides.PresetColor').DarkGreen))
60
+ txtVal.setLatinFont(Rjb::import('com.aspose.slides.FontData').new("Times New Roman"))
61
+
62
+ # Setting value axis title
63
+ chart.getAxes().getVerticalAxis().hasTitle(true)
64
+ chart.getAxes().getVerticalAxis().getTitle().addTextFrameForOverriding("")
65
+ valtitle = chart.getAxes().getVerticalAxis().getTitle().getTextFrameForOverriding().getParagraphs().get_Item(0).getPortions().get_Item(0)
66
+ valtitle.setText("Primary Axis")
67
+ valtitle.getPortionFormat().getFillFormat().setFillType(Rjb::import('com.aspose.slides.FillType').Solid)
68
+ valtitle.getPortionFormat().getFillFormat().getSolidFillColor().setColor(Rjb::import('java.awt.Color').GRAY)
69
+ valtitle.getPortionFormat().setFontHeight(20)
70
+ valtitle.getPortionFormat().setFontBold(Rjb::import('com.aspose.slides.NullableBool').True)
71
+ valtitle.getPortionFormat().setFontItalic(Rjb::import('com.aspose.slides.NullableBool').True)
72
+
73
+ # Setting Major grid lines format for Category axis
74
+ chart.getAxes().getHorizontalAxis().getMajorGridLinesFormat().getLine().getFillFormat().setFillType(Rjb::import('com.aspose.slides.FillType').Solid)
75
+ chart.getAxes().getHorizontalAxis().getMajorGridLinesFormat().getLine().getFillFormat().getSolidFillColor().setColor(Rjb::import('java.awt.Color').GREEN)
76
+ chart.getAxes().getHorizontalAxis().getMajorGridLinesFormat().getLine().setWidth(5)
77
+
78
+ # Setting Minor grid lines format for Category axis
79
+ chart.getAxes().getHorizontalAxis().getMinorGridLinesFormat().getLine().getFillFormat().setFillType(Rjb::import('com.aspose.slides.FillType').Solid)
80
+ chart.getAxes().getHorizontalAxis().getMinorGridLinesFormat().getLine().getFillFormat().getSolidFillColor().setColor(Rjb::import('java.awt.Color').YELLOW)
81
+ chart.getAxes().getHorizontalAxis().getMinorGridLinesFormat().getLine().setWidth(3)
82
+
83
+ #Setting Category Axis Text Properties
84
+ txtCat = chart.getAxes().getHorizontalAxis().getTextFormat().getPortionFormat()
85
+ txtCat.setFontBold(Rjb::import('com.aspose.slides.NullableBool').True)
86
+ txtCat.setFontHeight(16)
87
+ txtCat.setFontItalic(Rjb::import('com.aspose.slides.NullableBool').True)
88
+ txtCat.getFillFormat().setFillType(Rjb::import('com.aspose.slides.FillType').Solid)
89
+ txtCat.getFillFormat().getSolidFillColor().setColor(Rjb::import('java.awt.Color').BLUE)
90
+ txtCat.setLatinFont(Rjb::import('com.aspose.slides.FontData').new("Arial"))
91
+
92
+ # Setting Category Titile
93
+ chart.getAxes().getHorizontalAxis().hasTitle(true)
94
+ chart.getAxes().getHorizontalAxis().getTitle().addTextFrameForOverriding("")
95
+
96
+ catTitle = chart.getAxes().getHorizontalAxis().getTitle().getTextFrameForOverriding().getParagraphs().get_Item(0).getPortions().get_Item(0)
97
+ catTitle.setText("Sample Category")
98
+ catTitle.getPortionFormat().getFillFormat().setFillType(Rjb::import('com.aspose.slides.FillType').Solid)
99
+ catTitle.getPortionFormat().getFillFormat().getSolidFillColor().setColor(Rjb::import('java.awt.Color').GRAY)
100
+ catTitle.getPortionFormat().setFontHeight(20)
101
+ catTitle.getPortionFormat().setFontBold(Rjb::import('com.aspose.slides.NullableBool').True)
102
+ catTitle.getPortionFormat().setFontItalic(Rjb::import('com.aspose.slides.NullableBool').True)
103
+
104
+ # Setting category axis lable position
105
+ chart.getAxes().getHorizontalAxis().setTickLabelPosition(Rjb::import('com.aspose.slides.TickLabelPositionType').Low)
106
+
107
+ # Setting category axis lable rotation angle
108
+ chart.getAxes().getHorizontalAxis().setTickLabelRotationAngle(45)
109
+
110
+ # Setting Legends Text Properties
111
+ txtleg = chart.getLegend().getTextFormat().getPortionFormat()
112
+ txtleg.setFontBold(Rjb::import('com.aspose.slides.NullableBool').True)
113
+ txtleg.setFontHeight(16)
114
+ txtleg.setFontItalic(Rjb::import('com.aspose.slides.NullableBool').True)
115
+ txtleg.getFillFormat().setFillType(Rjb::import('com.aspose.slides.FillType').Solid)
116
+ txtleg.getFillFormat().getSolidFillColor().setColor(Rjb::import('java.awt.Color').new(Rjb::import('com.aspose.slides.PresetColor').DarkRed))
117
+
118
+ # Set show chart legends without overlapping chart
119
+ chart.getLegend().setOverlay(true)
120
+ #chart.ChartData.Series[0].PlotOnSecondAxis=true;
121
+ chart.getChartData().getSeries().get_Item(0).setPlotOnSecondAxis(true)
122
+
123
+ # Setting secondary value axis
124
+ chart.getAxes().getSecondaryVerticalAxis().isVisible(true)
125
+ chart.getAxes().getSecondaryVerticalAxis().getFormat().getLine().setStyle(Rjb::import('com.aspose.slides.LineStyle').ThickBetweenThin)
126
+ chart.getAxes().getSecondaryVerticalAxis().getFormat().getLine().setWidth(20)
127
+
128
+ # Setting secondary value axis Number format
129
+ chart.getAxes().getSecondaryVerticalAxis().isNumberFormatLinkedToSource(false)
130
+ chart.getAxes().getSecondaryVerticalAxis().setDisplayUnit(Rjb::import('com.aspose.slides.DisplayUnitType').Hundreds)
131
+ chart.getAxes().getSecondaryVerticalAxis().setNumberFormat ("0.0%")
132
+
133
+ # Setting chart maximum, minimum values
134
+ chart.getAxes().getSecondaryVerticalAxis().isAutomaticMajorUnit(false)
135
+ chart.getAxes().getSecondaryVerticalAxis().isAutomaticMaxValue(false)
136
+ chart.getAxes().getSecondaryVerticalAxis().isAutomaticMinorUnit(false)
137
+ chart.getAxes().getSecondaryVerticalAxis().isAutomaticMinValue(false)
138
+
139
+ chart.getAxes().getSecondaryVerticalAxis().setMaxValue(20)
140
+ chart.getAxes().getSecondaryVerticalAxis().setMinValue(-5)
141
+ chart.getAxes().getSecondaryVerticalAxis().setMinorUnit(0.5)
142
+ chart.getAxes().getSecondaryVerticalAxis().setMajorUnit(2.0)
143
+
144
+
145
+ # Setting chart back wall color
146
+ chart.getBackWall().setThickness(1)
147
+ chart.getBackWall().getFormat().getFill().setFillType(Rjb::import('com.aspose.slides.FillType').Solid)
148
+ chart.getBackWall().getFormat().getFill().getSolidFillColor().setColor(Rjb::import('java.awt.Color').ORANGE)
149
+
150
+ chart.getFloor().getFormat().getFill().setFillType(Rjb::import('com.aspose.slides.FillType').Solid)
151
+ chart.getFloor().getFormat().getFill().getSolidFillColor().setColor(Rjb::import('java.awt.Color').RED)
152
+
153
+ # Setting Plot area color
154
+ chart.getPlotArea().getFormat().getFill().setFillType(Rjb::import('com.aspose.slides.FillType').Solid)
155
+ chart.getPlotArea().getFormat().getFill().getSolidFillColor().setColor(Rjb::import('java.awt.Color').new(Rjb::import('com.aspose.slides.PresetColor').LightCyan))
156
+
157
+ # Save Presentation
158
+ pres.save(data_dir + "FormattedChart.pptx", Rjb::import('com.aspose.slides.SaveFormat').Pptx)
159
+
160
+ puts "Formatted chart entities, please check the output file."
161
+ end
162
+ end
163
+ end
@@ -0,0 +1,24 @@
1
+ module Asposeslidesjava
2
+ module SetLabelDistance
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
+ # Access first slide
10
+ sld = pres.getSlides().get_Item(0)
11
+
12
+ # Adding a chart on slide
13
+ ch = sld.getShapes().addChart(Rjb::import('com.aspose.slides.ChartType').ClusteredColumn, 20, 20, 500, 300)
14
+
15
+ # Setting the position of label from axis
16
+ ch.getAxes().getHorizontalAxis().setLabelOffset(500)
17
+
18
+ # Saving the presentation
19
+ pres.save(data_dir + "Position.pptx", Rjb::import('com.aspose.slides.SaveFormat').Pptx)
20
+
21
+ puts "Set label distance, please check the output file."
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,118 @@
1
+ module Asposeslidesjava
2
+ module SetPieChartColors
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
+ # Access first slide
10
+ sld = pres.getSlides().get_Item(0)
11
+
12
+ # Add chart with default data
13
+ chart_type = Rjb::import('com.aspose.slides.ChartType')
14
+ chart = sld.getShapes().addChart(chart_type.Pie, 100, 100, 400, 400)
15
+
16
+ # Setting chart Title
17
+ chart.getChartTitle().addTextFrameForOverriding("Sample Title")
18
+ chart.getChartTitle().getTextFrameForOverriding().getTextFrameFormat().setCenterText(Rjb::import('com.aspose.slides.NullableBool').True)
19
+ chart.getChartTitle().setHeight(20)
20
+ chart.hasTitle(true)
21
+
22
+ # Set first series to Show Values
23
+ chart.getChartData().getSeries().get_Item(0).getLabels().getDefaultDataLabelFormat().setShowValue(true)
24
+
25
+ # Setting the index of chart data sheet
26
+ defaultWorksheetIndex = 0
27
+
28
+ # Getting the chart data worksheet
29
+ fact = chart.getChartData().getChartDataWorkbook()
30
+
31
+ # Delete default generated series and categories
32
+ chart.getChartData().getSeries().clear()
33
+ chart.getChartData().getCategories().clear()
34
+
35
+ # Adding new categories
36
+ chart.getChartData().getCategories().add(fact.getCell(0, 1, 0, "First Qtr"))
37
+ chart.getChartData().getCategories().add(fact.getCell(0, 2, 0, "2nd Qtr"))
38
+ chart.getChartData().getCategories().add(fact.getCell(0, 3, 0, "3rd Qtr"))
39
+
40
+ # Adding new series
41
+ series = chart.getChartData().getSeries().add(fact.getCell(0, 0, 1, "Series 1"), chart.getType())
42
+
43
+ # Now populating series data
44
+ series.getDataPoints().addDataPointForPieSeries(fact.getCell(defaultWorksheetIndex, 1, 1, 20))
45
+ series.getDataPoints().addDataPointForPieSeries(fact.getCell(defaultWorksheetIndex, 2, 1, 50))
46
+ series.getDataPoints().addDataPointForPieSeries(fact.getCell(defaultWorksheetIndex, 3, 1, 30))
47
+
48
+ # Not working in new version
49
+ # Adding new points and setting sector color
50
+ chart.getChartData().getSeriesGroups().get_Item(0).isColorVaried(true)
51
+
52
+ fill_type = Rjb::import('com.aspose.slides.FillType')
53
+ line_style = Rjb::import('com.aspose.slides.LineStyle')
54
+ color = Rjb::import('java.awt.Color')
55
+ line_dash_style = Rjb::import('com.aspose.slides.LineDashStyle')
56
+ preset_color = Rjb::import('com.aspose.slides.PresetColor')
57
+
58
+ point = series.getDataPoints().get_Item(0)
59
+ point.getFormat().getFill().setFillType(fill_type.Solid)
60
+ point.getFormat().getFill().getSolidFillColor().setColor(color.CYAN)
61
+
62
+ # Setting Sector border
63
+ point.getFormat().getLine().getFillFormat().setFillType(fill_type.Solid)
64
+ point.getFormat().getLine().getFillFormat().getSolidFillColor().setColor(color.GRAY)
65
+ point.getFormat().getLine().setWidth(3.0)
66
+ point.getFormat().getLine().setStyle(line_style.ThinThick)
67
+ point.getFormat().getLine().setDashStyle(line_dash_style.DashDot)
68
+
69
+
70
+ point1 = series.getDataPoints().get_Item(1)
71
+ point1.getFormat().getFill().setFillType(fill_type.Solid)
72
+ point1.getFormat().getFill().getSolidFillColor().setColor(Rjb::import('java.awt.Color').new(preset_color.Brown))
73
+
74
+ # Setting Sector border
75
+ point1.getFormat().getLine().getFillFormat().setFillType(fill_type.Solid)
76
+ point1.getFormat().getLine().getFillFormat().getSolidFillColor().setColor(color.BLUE)
77
+ point1.getFormat().getLine().setWidth(3.0)
78
+ point1.getFormat().getLine().setStyle(line_style.Single)
79
+ point1.getFormat().getLine().setDashStyle(line_dash_style.LargeDashDot)
80
+
81
+ point2 = series.getDataPoints().get_Item(2)
82
+ point2.getFormat().getFill().setFillType(fill_type.Solid)
83
+ point2.getFormat().getFill().getSolidFillColor().setColor(Rjb::import('java.awt.Color').new(preset_color.Coral))
84
+
85
+ # Setting Sector border
86
+ point2.getFormat().getLine().getFillFormat().setFillType(fill_type.Solid)
87
+ point2.getFormat().getLine().getFillFormat().getSolidFillColor().setColor(color.RED)
88
+ point2.getFormat().getLine().setWidth(2.0)
89
+ point2.getFormat().getLine().setStyle(line_style.ThinThin)
90
+ point2.getFormat().getLine().setDashStyle(line_dash_style.LargeDashDotDot)
91
+
92
+ # Create custom labels for each of categories for new series
93
+ lbl1 = series.getDataPoints().get_Item(0).getLabel()
94
+
95
+ lbl1.getDataLabelFormat().setShowValue(true)
96
+
97
+ lbl2 = series.getDataPoints().get_Item(1).getLabel()
98
+ lbl2.getDataLabelFormat().setShowValue (true)
99
+ lbl2.getDataLabelFormat().setShowLegendKey(true)
100
+ lbl2.getDataLabelFormat().setShowPercentage(true)
101
+
102
+ lbl3 = series.getDataPoints().get_Item(2).getLabel()
103
+ lbl3.getDataLabelFormat().setShowSeriesName(true)
104
+ lbl3.getDataLabelFormat().setShowPercentage (true)
105
+
106
+ # Showing Leader Lines for Chart
107
+ series.getLabels().getDefaultDataLabelFormat().setShowLeaderLines(true)
108
+
109
+ # Setting Rotation Angle for Pie Chart Sectors
110
+ chart.getChartData().getSeriesGroups().get_Item(0).setFirstSliceAngle(180)
111
+
112
+ # Save presentation with chart
113
+ pres.save(data_dir + "AsposePieChart.pptx", Rjb::import('com.aspose.slides.SaveFormat').Pptx)
114
+
115
+ puts "Set pie chart sector colors, please check the output file."
116
+ end
117
+ end
118
+ end
@@ -0,0 +1,25 @@
1
+ module Asposeslidesjava
2
+ module ConvertingToHtml
3
+ def initialize()
4
+ # Converting Presentation to HTML format
5
+ convert_to_html()
6
+ end
7
+
8
+ def convert_to_html()
9
+ data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
10
+
11
+ # Instantiate a Presentation object that represents a PPTX file
12
+ pres = Rjb::import('com.aspose.slides.Presentation').new(data_dir + "Aspose.pptx")
13
+
14
+ html_opt = Rjb::import('com.aspose.slides.HtmlOptions').new
15
+ html_formatter = Rjb::import('com.aspose.slides.HtmlFormatter')
16
+ html_opt.setHtmlFormatter(html_formatter.createDocumentFormatter("",false))
17
+
18
+ # Saving the presentation to HTML format
19
+ save_format = Rjb::import('com.aspose.slides.SaveFormat')
20
+ pres.save(data_dir + "Aspose.html", save_format.Html, html_opt)
21
+
22
+ puts "Document has been converted, please check the output file."
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,37 @@
1
+ module Asposeslidesjava
2
+ module ConvertingToNotes
3
+ def initialize()
4
+ # Converting Presentation to TIFF Notes
5
+ convert_to_tiff_notes()
6
+
7
+ # Converting Presentation to TIFF Notes
8
+ convert_to_pdf_notes()
9
+ end
10
+
11
+ def convert_to_tiff_notes()
12
+ data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
13
+
14
+ # Instantiate a Presentation object that represents a PPTX file
15
+ pres = Rjb::import('com.aspose.slides.Presentation').new(data_dir + "Aspose.pptx")
16
+
17
+ # Saving the presentation
18
+ save_format = Rjb::import('com.aspose.slides.SaveFormat')
19
+ pres.save(data_dir + "Notes.tiff", save_format.TiffNotes)
20
+
21
+ puts "Document has been converted, please check the output file."
22
+ end
23
+
24
+ def convert_to_pdf_notes()
25
+ data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
26
+
27
+ # Instantiate a Presentation object that represents a PPTX file
28
+ pres = Rjb::import('com.aspose.slides.Presentation').new(data_dir + "Aspose.pptx")
29
+
30
+ # Saving the presentation
31
+ save_format = Rjb::import('com.aspose.slides.SaveFormat')
32
+ pres.save(data_dir + "Notes.pdf", save_format.Pdf)
33
+
34
+ puts "Document has been converted, please check the output file."
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,16 @@
1
+ module Asposeslidesjava
2
+ module ConvertingToPdf
3
+ def initialize()
4
+ data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
5
+
6
+ # Instantiate a Presentation object that represents a PPTX file
7
+ pres = Rjb::import('com.aspose.slides.Presentation').new(data_dir + "Aspose.pptx")
8
+
9
+ # Saving the PPTX presentation to Pdf format
10
+ save_format = Rjb::import('com.aspose.slides.SaveFormat')
11
+ pres.save(data_dir + "Aspose.pdf", save_format.Pdf)
12
+
13
+ puts "Document has been converted, please check the output file."
14
+ end
15
+ end
16
+ end