Skip to content

Commit 84da607

Browse files
Merge pull request #12 from masood-anwer/master
Aspose.Slides Java for Pptx4j
2 parents f2938c0 + 9731160 commit 84da607

File tree

61 files changed

+3015
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+3015
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2001-2015 Aspose Pty Ltd
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
## Aspose.Slides Java for Pptx4j
2+
3+
Aspose.Slides Java for Pptx4j is a project to provide comparative source code examples to do the same file processing tasks using Aspose.Slides for Java API and Pptx4j. Additionally, this project provides source code examples for advanced features offered by Aspose.Slides for Java which are missing in Pptx4j.
4+
5+
Below are some code comparisons and features of Aspose.Slides for Java that are not available in Pptx4j.
6+
7+
* [Code Comparison for common features in **Aspose.Slides** and **Pptx4j**](http://www.aspose.com/docs/display/slidesjava/2.2+Code+Comparison+for+Common+Features+in+Aspose.Slides+and+pptx4j)
8+
* [Missing Features of **Pptx4j** available in **Aspose.Slides**](http://www.aspose.com/docs/display/slidesjava/2.3+Missing+Features+of+pptx4j+in+Aspose.Slides)
9+
10+
These examples are helpful for developers who want to compare Pptx4j with Aspose.Slides OR migrate from Pptx4j to Aspose.
11+
12+
### Feedback and Suggestions
13+
14+
* Many more examples are yet to come. [Keep visiting us](http://www.aspose.com/java/total-component.aspx).
15+
* Raise your queries and suggest more examples via [Aspose Forums](http://www.aspose.com/community/forums/default.aspx) or via this social coding site.
16+
17+
## Why Aspose for Pptx4j ?
18+
19+
The developers looking for file format libraries may need to walk through the features provided by the libraries available on the market. Mainly, two factors are considered when choosing an option:
20+
21+
* Features
22+
* Efforts required to use the library
23+
24+
If you are a Java developer looking to choose a file format library to process files, you may want to compare Pptx4j library with Aspose. In this case, this project will help you to compare features and code in both libraries. Please visit project documentation for a comprehensive comparison.
25+
26+
## What is Doc4j ?
27+
28+
docx4j is an open source (ASLv2) Java library for creating and manipulating Microsoft Open XML (Word docx, Powerpoint pptx, and Excel xlsx) files.
29+
30+
It is similar to Microsoft's OpenXML SDK, but for Java. docx4j uses JAXB to create the in-memory object representation.
31+
32+
Its emphasis is on power: if the file format supports it, you can do it with docx4j. But first, you'll need to take the time to understand JAXB, and the Open XML file structure
33+
34+
docx4j was created by Plutext Pty Ltd in 2008 - using OpenXML4J for the OPC piece. Plutext still drives the project, but since then docx4j has benefited from contributions from many individuals. The contributors are listed in docx4j's pom.xml.
35+
36+
Read More at [docx4java.org](http://www.docx4java.org/)
37+
38+
## What is the use of Aspose Java Products?
39+
40+
Aspose are file format experts and provide APIs and components for various file formats including MS Office, OpenOffice, PDF and Image formats.
41+
42+
These APIs are available on a number of development platforms including Java. If you are a Java developer, you can use Aspose native Java APIs in your Java applications to process various file formats in just a few lines of codes.
43+
44+
All the Aspose APIs don’t have any dependency over any other engine. For example, you don’t need to have MS Office installed on the server to process MS Office files. Below you can read mor about Aspose.Slides for Java:
45+
46+
### Aspose.Slides for Java
47+
48+
[![Aspose.Slides for Java](http://www.aspose.com/App_Themes/V2/images/productLogos/JAVA/aspose_slides-for-java.jpg)](http://www.aspose.com/java/powerpoint-component.aspx)
49+
50+
Aspose.Slides for Java is a unique PowerPoint management component that enables Java based applications to read, write and manipulate PowerPoint documents without using Microsoft PowerPoint.
51+
52+
One can generate, modify, copy, convert, render and print presentations without installing Microsoft PowerPoint.
53+
54+
Aspose.Slides for Java supports presentation file formats including PPT, PPS, POT, PresentationML (OOXML, PPTX) and Open Document Presentations (ODP).
55+
56+
[Learn More](http://www.aspose.com/java/powerpoint-component.aspx)
57+
58+
## Download Latest Versions?
59+
60+
* [Latest Releases on Codeplex](https://asposeslidesjavapptx4j.codeplex.com/releases/view/618978)
61+
62+
## Clone Plugin SourceCodes?
63+
64+
This project is also hosted and maintained at CodePlex. To clone navigate to:
65+
66+
* [Aspose.Slides Java for Pptx4j on CodePlex - click here](https://asposeslidesjavapptx4j.codeplex.com/SourceControl/latest)
67+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
<groupId>com.aspose</groupId>
5+
<artifactId>AsposeSlidesJavaForPptx4j</artifactId>
6+
<version>1.0-SNAPSHOT</version>
7+
<packaging>jar</packaging>
8+
<properties>
9+
<maven.compiler.source>1.7</maven.compiler.source>
10+
<maven.compiler.target>1.7</maven.compiler.target>
11+
</properties>
12+
<dependencies>
13+
<dependency>
14+
<groupId>com.aspose</groupId>
15+
<artifactId>aspose-slides</artifactId>
16+
<version>15.5.0</version>
17+
<classifier>jdk16</classifier>
18+
</dependency>
19+
<dependency>
20+
<groupId>org.docx4j</groupId>
21+
<artifactId>docx4j</artifactId>
22+
<version>3.2.2</version>
23+
</dependency>
24+
</dependencies>
25+
<repositories>
26+
<repository>
27+
<id>aspose-maven-repository</id>
28+
<url>http://maven.aspose.com/repository/repo/</url>
29+
</repository>
30+
</repositories>
31+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package com.aspose.slides.examples;
2+
3+
import java.io.File;
4+
5+
public class Utils {
6+
7+
public static String getDataDir(Class c) {
8+
File dir = new File(System.getProperty("user.dir"));
9+
dir = new File(dir, "src");
10+
dir = new File(dir, "main");
11+
dir = new File(dir, "resources");
12+
13+
for (String s : c.getName().split("\\.")) {
14+
dir = new File(dir, s);
15+
if (dir.isDirectory() == false)
16+
dir.mkdir();
17+
}
18+
19+
System.out.println("Using data directory: " + dir.toString());
20+
return dir.toString() + File.separator;
21+
}
22+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
package com.aspose.slides.examples.asposefeatures.charts.charttrendlines;
2+
3+
import java.awt.Color;
4+
5+
import com.aspose.slides.ChartType;
6+
import com.aspose.slides.FillType;
7+
import com.aspose.slides.IChart;
8+
import com.aspose.slides.ITrendline;
9+
import com.aspose.slides.Presentation;
10+
import com.aspose.slides.SaveFormat;
11+
import com.aspose.slides.TrendlineType;
12+
import com.aspose.slides.examples.Utils;
13+
14+
public class AsposeAddChartTrendLines
15+
{
16+
public static void main(String[] args)
17+
{
18+
// The path to the documents directory.
19+
String dataDir = Utils.getDataDir(AsposeAddChartTrendLines.class);
20+
21+
//Creating empty presentation//Creating empty presentation
22+
Presentation pres = new Presentation();
23+
24+
//Creating a clustered column chart
25+
IChart chart = pres.getSlides().get_Item(0).getShapes().addChart(ChartType.ClusteredColumn, 20, 20, 500, 400);
26+
27+
//Adding potential trend line for chart series 1
28+
ITrendline tredLinep = chart.getChartData().getSeries().get_Item(0).getTrendLines().add(TrendlineType.Exponential);
29+
tredLinep.setDisplayEquation(false);
30+
tredLinep.setDisplayRSquaredValue(false);
31+
32+
//Adding Linear trend line for chart series 1
33+
ITrendline tredLineLin = chart.getChartData().getSeries().get_Item(0).getTrendLines().add(TrendlineType.Linear);
34+
tredLineLin.setTrendlineType(TrendlineType.Linear);
35+
tredLineLin.getFormat().getLine().getFillFormat().setFillType(FillType.Solid);
36+
tredLineLin.getFormat().getLine().getFillFormat().getSolidFillColor().setColor(Color.RED);
37+
38+
39+
//Adding Logarithmic trend line for chart series 2
40+
ITrendline tredLineLog = chart.getChartData().getSeries().get_Item(1).getTrendLines().add(TrendlineType.Logarithmic);
41+
tredLineLog.setTrendlineType(TrendlineType.Logarithmic);
42+
tredLineLog.addTextFrameForOverriding("New log trend line");
43+
44+
//Adding MovingAverage trend line for chart series 2
45+
ITrendline tredLineMovAvg = chart.getChartData().getSeries().get_Item(1).getTrendLines().add(TrendlineType.MovingAverage);
46+
tredLineMovAvg.setTrendlineType(TrendlineType.MovingAverage);
47+
tredLineMovAvg.setPeriod((byte)3);
48+
tredLineMovAvg.setTrendlineName("New TrendLine Name");
49+
50+
//Adding Polynomial trend line for chart series 3
51+
ITrendline tredLinePol = chart.getChartData().getSeries().get_Item(2).getTrendLines().add(TrendlineType.Polynomial);
52+
tredLinePol.setTrendlineType(TrendlineType.Polynomial);
53+
tredLinePol.setForward(1);
54+
tredLinePol.setOrder ((byte)3);
55+
56+
//Adding Power trend line for chart series 3
57+
ITrendline tredLinePower = chart.getChartData().getSeries().get_Item(1).getTrendLines().add(TrendlineType.Power);
58+
tredLinePower.setTrendlineType(TrendlineType.Power);
59+
tredLinePower.setBackward(1);
60+
61+
//Saving presentation
62+
pres.save(dataDir + "AsposeChartTrendLines.pptx", SaveFormat.Pptx);
63+
64+
System.out.println("AsposeChartTrendLines Saved.");
65+
}
66+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
package com.aspose.slides.examples.asposefeatures.charts.numberformatforchartdatacell;
2+
3+
import com.aspose.slides.ChartType;
4+
import com.aspose.slides.IChart;
5+
import com.aspose.slides.IChartDataPoint;
6+
import com.aspose.slides.IChartSeries;
7+
import com.aspose.slides.IChartSeriesCollection;
8+
import com.aspose.slides.ISlide;
9+
import com.aspose.slides.Presentation;
10+
import com.aspose.slides.SaveFormat;
11+
import com.aspose.slides.examples.Utils;
12+
13+
public class AsposeNumberFormatForChartDataCell
14+
{
15+
public static void main(String[] args)
16+
{
17+
// The path to the documents directory.
18+
String dataDir = Utils.getDataDir(AsposeNumberFormatForChartDataCell.class);
19+
20+
// Instantiate the presentation//Instantiate the presentation
21+
Presentation pres = new Presentation();
22+
23+
// Access the first presentation slide
24+
ISlide slide = pres.getSlides().get_Item(0);
25+
26+
// Adding a defautlt clustered column chart
27+
IChart chart = slide.getShapes().addChart(ChartType.ClusteredColumn, 50, 50, 500, 400);
28+
29+
// Accessing the chart series collection
30+
IChartSeriesCollection series = chart.getChartData().getSeries();
31+
32+
// Setting the preset number format
33+
// Traverse through every chart series
34+
for (IChartSeries ser : series)
35+
{
36+
// Traverse through every data cell in series
37+
for (IChartDataPoint cell : ser.getDataPoints())
38+
{
39+
// Setting the number format
40+
cell.getValue().getAsCell().setPresetNumberFormat((byte) 10); // 0.00%
41+
}
42+
}
43+
44+
// Saving presentation
45+
pres.save(dataDir + "AsposePresetNumberFormat.pptx", SaveFormat.Pptx);
46+
47+
System.out.println("AsposePresetNumberFormat Saved.");
48+
}
49+
}

0 commit comments

Comments
 (0)