Skip to content

Aspose.Slides Java for Pptx4j #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 15, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions Plugins/Aspose_Slides_Java_for_Pptx4j/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2001-2015 Aspose Pty Ltd

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
67 changes: 67 additions & 0 deletions Plugins/Aspose_Slides_Java_for_Pptx4j/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
## Aspose.Slides Java for Pptx4j

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.

Below are some code comparisons and features of Aspose.Slides for Java that are not available in Pptx4j.

* [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)
* [Missing Features of **Pptx4j** available in **Aspose.Slides**](http://www.aspose.com/docs/display/slidesjava/2.3+Missing+Features+of+pptx4j+in+Aspose.Slides)

These examples are helpful for developers who want to compare Pptx4j with Aspose.Slides OR migrate from Pptx4j to Aspose.

### Feedback and Suggestions

* Many more examples are yet to come. [Keep visiting us](http://www.aspose.com/java/total-component.aspx).
* Raise your queries and suggest more examples via [Aspose Forums](http://www.aspose.com/community/forums/default.aspx) or via this social coding site.

## Why Aspose for Pptx4j ?

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:

* Features
* Efforts required to use the library

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.

## What is Doc4j ?

docx4j is an open source (ASLv2) Java library for creating and manipulating Microsoft Open XML (Word docx, Powerpoint pptx, and Excel xlsx) files.

It is similar to Microsoft's OpenXML SDK, but for Java. docx4j uses JAXB to create the in-memory object representation.

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

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.

Read More at [docx4java.org](http://www.docx4java.org/)

## What is the use of Aspose Java Products?

Aspose are file format experts and provide APIs and components for various file formats including MS Office, OpenOffice, PDF and Image formats.

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.

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:

### Aspose.Slides for Java

[![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)

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.

One can generate, modify, copy, convert, render and print presentations without installing Microsoft PowerPoint.

Aspose.Slides for Java supports presentation file formats including PPT, PPS, POT, PresentationML (OOXML, PPTX) and Open Document Presentations (ODP).

[Learn More](http://www.aspose.com/java/powerpoint-component.aspx)

## Download Latest Versions?

* [Latest Releases on Codeplex](https://asposeslidesjavapptx4j.codeplex.com/releases/view/618978)

## Clone Plugin SourceCodes?

This project is also hosted and maintained at CodePlex. To clone navigate to:

* [Aspose.Slides Java for Pptx4j on CodePlex - click here](https://asposeslidesjavapptx4j.codeplex.com/SourceControl/latest)

31 changes: 31 additions & 0 deletions Plugins/Aspose_Slides_Java_for_Pptx4j/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<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">
<modelVersion>4.0.0</modelVersion>
<groupId>com.aspose</groupId>
<artifactId>AsposeSlidesJavaForPptx4j</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-slides</artifactId>
<version>15.5.0</version>
<classifier>jdk16</classifier>
</dependency>
<dependency>
<groupId>org.docx4j</groupId>
<artifactId>docx4j</artifactId>
<version>3.2.2</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>aspose-maven-repository</id>
<url>http://maven.aspose.com/repository/repo/</url>
</repository>
</repositories>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.aspose.slides.examples;

import java.io.File;

public class Utils {

public static String getDataDir(Class c) {
File dir = new File(System.getProperty("user.dir"));
dir = new File(dir, "src");
dir = new File(dir, "main");
dir = new File(dir, "resources");

for (String s : c.getName().split("\\.")) {
dir = new File(dir, s);
if (dir.isDirectory() == false)
dir.mkdir();
}

System.out.println("Using data directory: " + dir.toString());
return dir.toString() + File.separator;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package com.aspose.slides.examples.asposefeatures.charts.charttrendlines;

import java.awt.Color;

import com.aspose.slides.ChartType;
import com.aspose.slides.FillType;
import com.aspose.slides.IChart;
import com.aspose.slides.ITrendline;
import com.aspose.slides.Presentation;
import com.aspose.slides.SaveFormat;
import com.aspose.slides.TrendlineType;
import com.aspose.slides.examples.Utils;

public class AsposeAddChartTrendLines
{
public static void main(String[] args)
{
// The path to the documents directory.
String dataDir = Utils.getDataDir(AsposeAddChartTrendLines.class);

//Creating empty presentation//Creating empty presentation
Presentation pres = new Presentation();

//Creating a clustered column chart
IChart chart = pres.getSlides().get_Item(0).getShapes().addChart(ChartType.ClusteredColumn, 20, 20, 500, 400);

//Adding potential trend line for chart series 1
ITrendline tredLinep = chart.getChartData().getSeries().get_Item(0).getTrendLines().add(TrendlineType.Exponential);
tredLinep.setDisplayEquation(false);
tredLinep.setDisplayRSquaredValue(false);

//Adding Linear trend line for chart series 1
ITrendline tredLineLin = chart.getChartData().getSeries().get_Item(0).getTrendLines().add(TrendlineType.Linear);
tredLineLin.setTrendlineType(TrendlineType.Linear);
tredLineLin.getFormat().getLine().getFillFormat().setFillType(FillType.Solid);
tredLineLin.getFormat().getLine().getFillFormat().getSolidFillColor().setColor(Color.RED);


//Adding Logarithmic trend line for chart series 2
ITrendline tredLineLog = chart.getChartData().getSeries().get_Item(1).getTrendLines().add(TrendlineType.Logarithmic);
tredLineLog.setTrendlineType(TrendlineType.Logarithmic);
tredLineLog.addTextFrameForOverriding("New log trend line");

//Adding MovingAverage trend line for chart series 2
ITrendline tredLineMovAvg = chart.getChartData().getSeries().get_Item(1).getTrendLines().add(TrendlineType.MovingAverage);
tredLineMovAvg.setTrendlineType(TrendlineType.MovingAverage);
tredLineMovAvg.setPeriod((byte)3);
tredLineMovAvg.setTrendlineName("New TrendLine Name");

//Adding Polynomial trend line for chart series 3
ITrendline tredLinePol = chart.getChartData().getSeries().get_Item(2).getTrendLines().add(TrendlineType.Polynomial);
tredLinePol.setTrendlineType(TrendlineType.Polynomial);
tredLinePol.setForward(1);
tredLinePol.setOrder ((byte)3);

//Adding Power trend line for chart series 3
ITrendline tredLinePower = chart.getChartData().getSeries().get_Item(1).getTrendLines().add(TrendlineType.Power);
tredLinePower.setTrendlineType(TrendlineType.Power);
tredLinePower.setBackward(1);

//Saving presentation
pres.save(dataDir + "AsposeChartTrendLines.pptx", SaveFormat.Pptx);

System.out.println("AsposeChartTrendLines Saved.");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package com.aspose.slides.examples.asposefeatures.charts.numberformatforchartdatacell;

import com.aspose.slides.ChartType;
import com.aspose.slides.IChart;
import com.aspose.slides.IChartDataPoint;
import com.aspose.slides.IChartSeries;
import com.aspose.slides.IChartSeriesCollection;
import com.aspose.slides.ISlide;
import com.aspose.slides.Presentation;
import com.aspose.slides.SaveFormat;
import com.aspose.slides.examples.Utils;

public class AsposeNumberFormatForChartDataCell
{
public static void main(String[] args)
{
// The path to the documents directory.
String dataDir = Utils.getDataDir(AsposeNumberFormatForChartDataCell.class);

// Instantiate the presentation//Instantiate the presentation
Presentation pres = new Presentation();

// Access the first presentation slide
ISlide slide = pres.getSlides().get_Item(0);

// Adding a defautlt clustered column chart
IChart chart = slide.getShapes().addChart(ChartType.ClusteredColumn, 50, 50, 500, 400);

// Accessing the chart series collection
IChartSeriesCollection series = chart.getChartData().getSeries();

// Setting the preset number format
// Traverse through every chart series
for (IChartSeries ser : series)
{
// Traverse through every data cell in series
for (IChartDataPoint cell : ser.getDataPoints())
{
// Setting the number format
cell.getValue().getAsCell().setPresetNumberFormat((byte) 10); // 0.00%
}
}

// Saving presentation
pres.save(dataDir + "AsposePresetNumberFormat.pptx", SaveFormat.Pptx);

System.out.println("AsposePresetNumberFormat Saved.");
}
}
Loading