Skip to content
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
19 changes: 19 additions & 0 deletions Plugins/Aspose_Slides_Java_for_PHP/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Aspose.Slides Java for PHP
Aspose Slides Java for PHP is a PHP project that demonstrates / provides the Aspose.Slides for Java API usage examples in PHP by using PHP/JAVA Bridge.

You will need to configure PHP/Java Bridge before using any of the Aspose provided Java APIs in PHP e.g Aspose.Words, Aspose.Cells and Aspose.Slides etc.

For the configuration/setup of PHP/Java Bridge, please see:

http://php-java-bridge.sourceforge.net/pjb/index.php

To download Aspose.Cells for Java API to be used with these examples through PHP/Java Bridge
Please navigate to:

http://www.aspose.com/community/files/72/java-components/aspose.slides-for-java/

For most complete documentation of the project, check Aspose.Slides Java for PHP confluence wiki link:

http://www.aspose.com/docs/display/slidesjava/5.+Aspose.Slides+Java+for+PHP


21 changes: 21 additions & 0 deletions Plugins/Aspose_Slides_Java_for_PHP/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "asposeslides/aspose_slides_java_for_php",
"description": "Aspose Slides Java Examples for PHP Developers. Helps you understand how to use Aspose.Slides Java classes in your PHP Projects.",
"type": "library",
"license": "MIT",
"authors": [
{
"name": "Fahad Adeel",
"email": "fahadadeel@gmail.com"
}
],
"minimum-stability": "dev",
"require": {
"php": ">=5.3.0"
},
"autoload": {
"psr-4": {
"Aspose\\Slides\\": "src/aspose/slides"
}
}
}
19 changes: 19 additions & 0 deletions Plugins/Aspose_Slides_Java_for_PHP/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php

namespace Aspose\Slides\IntroductionToPresentation;

use com\aspose\slides\Presentation as Presentation;
use com\aspose\slides\ShapeType as ShapeType;
use com\aspose\slides\FillType as FillType;
use com\aspose\slides\SaveFormat as SaveFormat;
use java\awt\Color as Color;

class HelloWorld {

public static function run($dataDir=null)
{

# Instantiate Presentation
$pres = new Presentation();

# Get the first slide
$slide = $pres->getSlides()->get_Item(0);

# Add an AutoShape of Rectangle type
$shape_type = new ShapeType();
$ashp = $slide->getShapes()->addAutoShape($shape_type->Rectangle, 150, 75, 150, 50);

# Add ITextFrame to the Rectangle
$ashp->addTextFrame("Hello World");

# Change the text color to Black (which is White by default)
$fill_type = new FillType();
$color = new Color();
$ashp->getTextFrame()->getParagraphs()->get_Item(0)->getPortions()->get_Item(0)->getPortionFormat()->getFillFormat()->setFillType($fill_type->Solid);
$ashp->getTextFrame()->getParagraphs()->get_Item(0)->getPortions()->get_Item(0)->getPortionFormat()->getFillFormat()->getSolidFillColor()->setColor($color->BLACK);

# Change the line color of the rectangle to White
$ashp->getShapeStyle()->getLineColor()->setColor($color->WHITE);

# Remove any fill formatting in the shape
$ashp->getFillFormat()->setFillType ($fill_type->NoFill);

# Save the presentation to disk
$save_format = new SaveFormat();
$pres->save($dataDir . "HelloWorld.pptx", $save_format->Pptx);

print "Document has been saved, please check the output file.";

}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php
namespace Aspose\Slides\WorkingWithActiveXControls;

use com\aspose\slides\Presentation as Presentation;
use com\aspose\slides\ControlType as ControlType;
use com\aspose\slides\SaveFormat as SaveFormat;

class AddActiveX{

public static function run($dataDir=null){

# Create an instance of Presentation class
$pres = new Presentation();

# Adding the Media Player ActiveX control
$controlType = new ControlType();
$pres->getSlides()->get_Item(0)->getControls()->addControl($controlType->WindowsMediaPlayer, 100, 100, 400, 400);

# Access the Media Player ActiveX control and set the video path
$pres->getSlides()->get_Item(0)->getControls()->get_Item(0)->getProperties()->set_Item("URL" , $dataDir . "Wildlife.mp4");

# Write the presentation as a PPTX file
$saveFormat = new SaveFormat();
$pres->save($dataDir . "AddActiveX.pptx", $saveFormat->Pptx);

print "Added ActiveX control, please check the output file.".PHP_EOL;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php

namespace Aspose\Slides\WorkingWithCharts;

use com\aspose\slides\Presentation as Presentation;
use com\aspose\slides\SaveFormat as SaveFormat;
use com\aspose\slides\ShapeType as ShapeType;
use com\aspose\slides\ChartType as ChartType;
use com\aspose\slides\LineDashStyle as LineDashStyle;
use com\aspose\slides\LineArrowheadLength as LineArrowheadLength;
use com\aspose\slides\LineArrowheadStyle as LineArrowheadStyle;
use com\aspose\slides\PresetColor as PresetColor;
use com\aspose\slides\FillType as FillType;
use com\aspose\slides\NullableBool as NullableBool;
use com\aspose\slides\MarkerStyleType as MarkerStyleType;
use java\awt\Color as Color;


class ChartLegend
{

public static function run($dataDir = null)
{
# Setting Custom Location and Size for Chart legend
ChartLegend::set_location_and_size($dataDir);

}

public static function set_location_and_size($dataDir=null){

# Creating empty presentation
$pres = new Presentation();

# Get reference of the slide
$slide = $pres->getSlides()->get_Item(0);

# Add a clustered column chart on the slide

$chartType=new ChartType();

$chart = $slide->getShapes()->addChart($chartType->ClusteredColumn, 50, 50, 500, 500);

# Set Legend Properties
$chart->getLegend()->setX(50 / $chart->getWidth());
$chart->getLegend()->setY (50 / $chart->getHeight());
$chart->getLegend()->setWidth(100 / $chart->getWidth());
$chart->getLegend()->setHeight(100 / $chart->getHeight());

# Saving the presentation
$save_format = new SaveFormat();
$pres->save($dataDir . "Legend.pptx", $save_format->Pptx);

print "Set custom location and size of chart legend, please check the output file.".PHP_EOL;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
<?php
namespace Aspose\Slides\WorkingWithCharts;

use com\aspose\slides\Presentation as Presentation;
use com\aspose\slides\ChartType as ChartType;
use com\aspose\slides\SaveFormat as SaveFormat;

class ChartProperties{

public static function run($dataDir=null){
# Setting the RotationX, RotationY and DepthPercents properties of 3D Chart.
ChartProperties::set_rotation_and_depth($dataDir);

# Setting the GapWidth property of Chart Series
ChartProperties::set_gapwidth($dataDir);
}

public static function set_rotation_and_depth($dataDir=null){

$pres = new Presentation();

# Access first slide
$sld = $pres->getSlides()->get_Item(0);

# Add chart with default data
$charType=new ChartType();
$chart = $sld->getShapes()->addChart($charType->StackedColumn3D, 0, 0, 500, 500);

# Getting the chart data worksheet
$fact = $chart->getChartData()->getChartDataWorkbook();

# Delete default generated series and categories
$chart->getChartData()->getSeries()->clear();
$chart->getChartData()->getCategories()->clear();

# Adding new series
$chart->getChartData()->getSeries()->add($fact->getCell(0, 0, 1, "Series 1"), $chart->getType());
$chart->getChartData()->getSeries()->add($fact->getCell(0, 0, 2, "Series 2"), $chart->getType());

# Adding new categories
$chart->getChartData()->getCategories()->add($fact->getCell(0, 1, 0, "Caetegoty 1"));
$chart->getChartData()->getCategories()->add($fact->getCell(0, 2, 0, "Caetegoty 2"));
$chart->getChartData()->getCategories()->add($fact->getCell(0, 3, 0, "Caetegoty 3"));

# Set Rotation3D properties
$chart->getRotation3D()->setRightAngleAxes(true);
$chart->getRotation3D()->setRotationX(40);
$chart->getRotation3D()->setRotationY(270);
$chart->getRotation3D()->setDepthPercents(150);

# Take first chart series
$series = $chart->getChartData()->getSeries()->get_Item(0);

# Populating series data
$series->getDataPoints()->addDataPointForBarSeries($fact->getCell(0, 1, 1, 20));
$series->getDataPoints()->addDataPointForBarSeries($fact->getCell(0, 2, 1, 50));
$series->getDataPoints()->addDataPointForBarSeries($fact->getCell(0, 3, 1, 30));

# Take second chart series
$series = $chart->getChartData()->getSeries()->get_Item(1);

# Populating series data
$series->getDataPoints()->addDataPointForBarSeries($fact->getCell(0, 1, 2, 30));
$series->getDataPoints()->addDataPointForBarSeries($fact->getCell(0, 2, 2, 10));
$series->getDataPoints()->addDataPointForBarSeries($fact->getCell(0, 3, 2, 60));

# Saving the presentation
$save_format = new SaveFormat();
$pres->save($dataDir . "3Drotation.pptx", $save_format->Pptx);

print "Done with rotation, please check the output file.".PHP_EOL;
}

public static function set_gapwidth($dataDir=null){

$pres = new Presentation();

# Access first slide
$sld = $pres->getSlides()->get_Item(0);

# Add chart with default data
$charType=new ChartType();
$chart = $sld->getShapes()->addChart($charType->StackedColumn3D, 0, 0, 500, 500);

# Getting the chart data worksheet
$fact = $chart->getChartData()->getChartDataWorkbook();

# Delete default generated series and categories
$chart->getChartData()->getSeries()->clear();
$chart->getChartData()->getCategories()->clear();

# Adding new series
$chart->getChartData()->getSeries()->add($fact->getCell(0, 0, 1, "Series 1"), $chart->getType());
$chart->getChartData()->getSeries()->add($fact->getCell(0, 0, 2, "Series 2"), $chart->getType());

# Adding new categories
$chart->getChartData()->getCategories()->add($fact->getCell(0, 1, 0, "Caetegoty 1"));
$chart->getChartData()->getCategories()->add($fact->getCell(0, 2, 0, "Caetegoty 2"));
$chart->getChartData()->getCategories()->add($fact->getCell(0, 3, 0, "Caetegoty 3"));

# Take first chart series
$series = $chart->getChartData()->getSeries()->get_Item(0);

# Populating series data
$series->getDataPoints()->addDataPointForBarSeries($fact->getCell(0, 1, 1, 20));
$series->getDataPoints()->addDataPointForBarSeries($fact->getCell(0, 2, 1, 50));
$series->getDataPoints()->addDataPointForBarSeries($fact->getCell(0, 3, 1, 30));

# Take second chart series
$series = $chart->getChartData()->getSeries()->get_Item(1);

# Populating series data
$series->getDataPoints()->addDataPointForBarSeries($fact->getCell(0, 1, 2, 30));
$series->getDataPoints()->addDataPointForBarSeries($fact->getCell(0, 2, 2, 10));
$series->getDataPoints()->addDataPointForBarSeries($fact->getCell(0, 3, 2, 60));

# Set GapWidth value
$series->getParentSeriesGroup()->setGapWidth(75);

# Saving the presentation
$save_format = new SaveFormat();
$pres->save($dataDir . "SetGapWidth.pptx", $save_format->Pptx);

print "Set Gapwidth property of chart series, please check the output file.".PHP_EOL;

}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php
namespace Aspose\Slides\WorkingWithCharts;

use com\aspose\slides\Presentation as Presentation;
use com\aspose\slides\ChartType as ChartType;
use com\aspose\slides\SaveFormat as SaveFormat;

class ChartSeries{

public static function run($dataDir = null){
# Adding Chart Series Overlap for Charts
ChartSeries::add_overlap_for_chart($dataDir);
}

public static function add_overlap_for_chart($dataDir=null)
{
# Instantiate Presentation class that represents the presentation file
$pres = new Presentation();

# Adding chart
$chartType = new ChartType();

$chart = $pres->getSlides()->get_Item(0)->getShapes()->addChart($chartType->ClusteredColumn, 50, 50, 600, 400, true);

$series = $chart->getChartData()->getSeries();
if ($series->get_Item(0)->getOverlap() == 0) {
# Setting series overlap
$series -> get_Item(0) -> getParentSeriesGroup()->setOverlap(-30);
}

# Saving the presentation
$save_format = new SaveFormat();
$pres->save($dataDir . "Overlap.pptx", $save_format->Pptx);

print "Added chart series overlap for charts, please check the output file.".PHP_EOL;
}

}
Loading