Knowledgebase (2345)
Children categories
This article demonstrates how to add shadow effects to shapes in PowerPoint by using Spire.Presentation for Java. In addition to the PresetShadowEffect shown in this article, you can also add InnerShadowEffect, OuterShadowEffect and SoftEdgeEffect, etc.
import com.spire.presentation.*;
import com.spire.presentation.drawing.*;
import java.awt.*;
import java.awt.geom.Rectangle2D;
public class setShadowEffect {
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.
Rectangle2D rect = new Rectangle2D.Float(120, 100, 150, 300);
IAutoShape shape = slide.getShapes().appendShape(ShapeType.RECTANGLE, rect);
//Fill the shape with a picture
shape.getFill().setFillType(FillFormatType.PICTURE);
shape.getFill().getPictureFill().getPicture().setUrl("https://cdn.e-iceblue.com/C:\\Users\\Administrator\\Desktop\\img.png");
shape.getLine().setFillType(FillFormatType.NONE);
shape.getFill().getPictureFill().setFillType(PictureFillType.STRETCH);
//Set shadow effect
PresetShadow presetShadow = new PresetShadow();
presetShadow.setPreset(PresetShadowValue.BACK_RIGHT_PERSPECTIVE);
presetShadow.getColorFormat().setColor(Color.lightGray);
//Apply the shadow effect to shape
shape.getEffectDag().setPresetShadowEffect(presetShadow);
//Save the document
ppt.saveToFile("output/ShapeShadow.pptx", FileFormat.PPTX_2013);
}
}

Published in
Image and Shapes
Tagged under
This article demonstrates how to detect merged cells in an Excel worksheet and unmerge the merged cells using Spire.XLS for Java.
The input Excel file:

import com.spire.xls.CellRange;
import com.spire.xls.ExcelVersion;
import com.spire.xls.Workbook;
import com.spire.xls.Worksheet;
public class DetectMergedCells {
public static void main(String[] args) throws Exception {
//Create a Workbook instance
Workbook workbook = new Workbook();
//Load the Excel file
workbook.loadFromFile( "Input.xlsx");
//Get the first worksheet
Worksheet sheet = workbook.getWorksheets().get(0);
//Get the merged cell ranges in the first worksheet and put them into a CellRange array
CellRange[] range = sheet.getMergedCells();
//Traverse through the array and unmerge the merged cells
for(CellRange cell : range){
cell.unMerge();
}
//Save the result file
workbook.saveToFile("DetectMergedCells.xlsx", ExcelVersion.Version2013);
}
}
The output Excel file:

Published in
Cells
Tagged under
This article demonstrates how to remove a specific section or all the sections but keep the slide(s) in the section(s) in PowerPoint by using Spire.Presentation for .NET.
Below is the screenshot of the input PowerPoint document which contains two sections:

C#
//Create a Presentation instance
Presentation ppt = new Presentation();
//Load a PowerPoint document
ppt.LoadFromFile("AddSection.pptx");
//Remove the second section
ppt.SectionList.RemoveAt(1);
//Remove all the sections
//ppt.SectionList.RemoveAll();
//Save the result document
ppt.SaveToFile("RemoveSection.pptx", FileFormat.Pptx2013);
VB.NET
'Create a Presentation instance
Dim ppt As Presentation = New Presentation
'Load a PowerPoint document
ppt.LoadFromFile("AddSection.pptx")
'Remove the second section
ppt.SectionList.RemoveAt(1)
'Remove all the sections
'ppt.SectionList.RemoveAll()
'Save the result document
ppt.SaveToFile("RemoveSection.pptx", FileFormat.Pptx2013)
The output PowerPoint document after removing the second section:

Published in
Document Operation
Tagged under