Java (482)
We have already introduced how to add animation effect to shape in PowerPoint, in this article, we will introduce how to add animation effect to paragraph in PowerPoint using Spire.Presentation for Java.
import com.spire.presentation.*;
import com.spire.presentation.drawing.FillFormatType;
import com.spire.presentation.drawing.animation.*;
import java.awt.*;
import java.awt.geom.Rectangle2D;
public class AddAnimationOnParagraph {
public static void main(String[] args) throws Exception {
//Create a Presentation instance
Presentation ppt = new Presentation();
//Get the first slide
ISlide slide = ppt.getSlides().get(0);
//Add a shape to the slide
IAutoShape shape = slide.getShapes().appendShape(ShapeType.RECTANGLE, new Rectangle2D.Double(150, 150, 450, 100));
shape.getFill().setFillType(FillFormatType.SOLID);
shape.getFill().getSolidColor().setColor(Color.gray);
shape.getShapeStyle().getLineColor().setColor(Color.white);
shape.appendTextFrame("This demo shows how to apply animation on paragraph in PPT document.");
//Add animation effect to the first paragraph in the shape
AnimationEffect animation = shape.getSlide().getTimeline().getMainSequence().addEffect(shape, AnimationEffectType.FLOAT);
animation.setStartEndParagraphs(0, 0);
//Save the result document
ppt.saveToFile("AddAnimationOnPara.pptx", FileFormat.PPTX_2013);
ppt.dispose();
}
}
Output:

Published in
Paragraph and Text
Tagged under
This article demonstrates how to create pivot chart in an Excel file in Java using Spire.XLS for Java.
The input Excel file:

import com.spire.xls.*;
import com.spire.xls.core.IPivotTable;
public class CreatePivotChart {
public static void main(String[] args) {
//Load the Excel file
Workbook workbook = new Workbook();
workbook.loadFromFile("Sample.xlsx");
//Get the first worksheet
Worksheet sheet = workbook.getWorksheets().get(0);
//get the first pivot table in the worksheet
IPivotTable pivotTable = sheet.getPivotTables().get(0);
//Add a clustered column chart based on the pivot table data to the second worksheet
Chart chart = workbook.getWorksheets().get(1).getCharts().add(ExcelChartType.ColumnClustered, pivotTable);
//Set chart position
chart.setTopRow(2);
chart.setBottomRow(15);
//Set chart title
chart.setChartTitle("Total");
//Save the result file
workbook.saveToFile("CreatPivotChart.xlsx", ExcelVersion.Version2013);
}
}
Output:

Published in
Pivot Table
Tagged under
We have already demonstrated how to insert HTML formatted text to a Presentation slide by using Spire.Presentation for Java. This article will introduce the way to insert HTML with images to PowerPoint and each html tag will be added to the slide as a separate shape.
import com.spire.presentation.*;
import com.spire.presentation.collections.*;
public class AddHTMLWithImage {
public static void main(String[] args) throws Exception {
//Create an instance of presentation document
Presentation ppt = new Presentation();
//Get the shapes on the first slide.
ShapeList shapes = ppt.getSlides().get(0).getShapes();
//Add contents to shapes from HTML codes, which includes text and image.
shapes.addFromHtml("<html><div><p>E-iceblue</p>" +
"<p><img src='https://cdn.e-iceblue.com/C:\\Users\\Test1\\Desktop\\logo.png'/></p>" +
"<p>Spire.Presentation for Java</p></html>");
//Save the document
String result = "output/insertHtmlWithImage.pptx";
ppt.saveToFile(result, FileFormat.PPTX_2013);
}
}

Published in
Paragraph and Text
Tagged under