Knowledgebase (2300)
This article demonstrates how to add a hyperlink to an image in a PowerPint slide using Spire.Presentation for Java.
import com.spire.presentation.*;
import com.spire.presentation.drawing.FillFormatType;
import java.awt.geom.Rectangle2D;
public class AddHyperlinkToImage {
public static void main(String[] args) throws Exception {
//create a Presentation object
Presentation presentation = new Presentation();
//get the first slide
ISlide slide = presentation.getSlides().get(0);
//add an image to slide
String imaPath = "C:\\Users\\Administrator\\Desktop\\logo.png";
Rectangle2D.Float rect = new Rectangle2D.Float(50, 50, 220, 60);
IEmbedImage image = slide.getShapes().appendEmbedImage(ShapeType.RECTANGLE, imaPath, rect);
//set the line of image shape to none
image.getLine().setFillType(FillFormatType.NONE);
//add a hyperlink to image
ClickHyperlink hyperlink = new ClickHyperlink("https://www.e-iceblue.com");
image.setClick(hyperlink);
//save the file
presentation.saveToFile("output/ImageHyperLink.pptx", FileFormat.PPTX_2013);
}
}

Published in
Hyperlink
Tagged under
With Spire.XLS for .NET, developers can easily use C# to add shapes to Excel worksheet. From version 9.8.11, Spire.XLS supports to add arrow lines to Excel worksheet. The following sample will show you how to insert arrow line, double Arrow, Elbow Arrow, Elbow Double-Arrow, Curved Arrow and Curved Double-Arrow to Excel worksheet in C#.
using Spire.Xls;
using System.Drawing;
namespace Add_Lines_to_Excel
{
class Program
{
static void Main(string[] args)
{
//Initiate a Workbook object and get the first worksheet
Workbook workbook = new Workbook();
Worksheet sheet = workbook.Worksheets[0];
//Add a Double Arrow and fill the line with solid color
var line = sheet.TypedLines.AddLine();
line.Top = 10;
line.Left = 20;
line.Width = 100;
line.Height = 0;
line.Color = Color.Blue;
line.BeginArrowHeadStyle = ShapeArrowStyleType.LineArrow;
line.EndArrowHeadStyle = ShapeArrowStyleType.LineArrow;
//Add an Arrow and fill the line with solid color
var line_1 = sheet.TypedLines.AddLine();
line_1.Top = 50;
line_1.Left = 30;
line_1.Width = 100;
line_1.Height = 100;
line_1.Color = Color.Red;
line_1.BeginArrowHeadStyle = ShapeArrowStyleType.LineNoArrow;
line_1.EndArrowHeadStyle = ShapeArrowStyleType.LineArrow;
//Add an Elbow Arrow Connector
Spire.Xls.Core.Spreadsheet.Shapes.XlsLineShape line3 = sheet.TypedLines.AddLine() as Spire.Xls.Core.Spreadsheet.Shapes.XlsLineShape;
line3.LineShapeType = LineShapeType.ElbowLine;
line3.Width = 30;
line3.Height = 50;
line3.EndArrowHeadStyle = ShapeArrowStyleType.LineArrow;
line3.Top = 100;
line3.Left = 50;
//Add an Elbow Double-Arrow Connector
Spire.Xls.Core.Spreadsheet.Shapes.XlsLineShape line2 = sheet.TypedLines.AddLine() as Spire.Xls.Core.Spreadsheet.Shapes.XlsLineShape;
line2.LineShapeType = LineShapeType.ElbowLine;
line2.Width = 50;
line2.Height = 50;
line2.EndArrowHeadStyle = ShapeArrowStyleType.LineArrow;
line2.BeginArrowHeadStyle = ShapeArrowStyleType.LineArrow;
line2.Left = 120;
line2.Top = 100;
//Add a Curved Arrow Connector
line3 = sheet.TypedLines.AddLine() as Spire.Xls.Core.Spreadsheet.Shapes.XlsLineShape;
line3.LineShapeType = LineShapeType.CurveLine;
line3.Width = 30;
line3.Height = 50;
line3.EndArrowHeadStyle = ShapeArrowStyleType.LineArrowOpen;
line3.Top = 100;
line3.Left = 200;
//Add a Curved Double-Arrow Connector
line2 = sheet.TypedLines.AddLine() as Spire.Xls.Core.Spreadsheet.Shapes.XlsLineShape;
line2.LineShapeType = LineShapeType.CurveLine;
line2.Width = 30;
line2.Height = 50;
line2.EndArrowHeadStyle = ShapeArrowStyleType.LineArrowOpen;
line2.BeginArrowHeadStyle = ShapeArrowStyleType.LineArrowOpen;
line2.Left = 250;
line2.Top = 100;
//Save the file
workbook.SaveToFile("AddLines.xlsx", ExcelVersion.Version2013);
}
}
}

Published in
Objects
Tagged under
This article demonstrates how to render text with simple HTML tags to formatted text in a presentation slide by using Spire.Presentation for Java.
import com.spire.presentation.FileFormat;
import com.spire.presentation.IAutoShape;
import com.spire.presentation.Presentation;
import com.spire.presentation.ShapeType;
import com.spire.presentation.drawing.FillFormatType;
import java.awt.geom.Rectangle2D;
public class InsertHTML {
public static void main(String[] args) throws Exception {
//create a Presentation object
Presentation ppt = new Presentation();
//add a shape to the first slide
IAutoShape shape = ppt.getSlides().get(0).getShapes().appendShape(ShapeType.RECTANGLE, new Rectangle2D.Float(50, 50, 400, 100));
shape.getFill().setFillType(FillFormatType.NONE);
//clear the default paragraph
shape.getTextFrame().getParagraphs().clear();
//define html string
String htmlString = "<ul>" +
"<li style=\"color:blue\">Spire.Presentation for Java</li>" +
"<li style=\"color:green\">Spire.PDF for Java</li>" +
"<li style=\"color:gray\">Spire.Doc for Java</li>" +
"<li style=\"color:red\">Spire.Barcode for Java</li>" +
"</ul>";
//insert html string in the shape
shape.getTextFrame().getParagraphs().addFromHtml(htmlString);
//save to file
ppt.saveToFile("output/InsertHtml.pptx", FileFormat.PPTX_2013);
}
}

Published in
Paragraph and Text
Tagged under