Knowledgebase (2345)
Children categories
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
This article demonstrates how to add hyperlinks to SmartArt Nodes in a PowerPoint document in C# and VB.NET using Spire.Presentation for .NET.
C#
using Spire.Presentation;
using Spire.Presentation.Diagrams;
namespace SmartArt
{
class Program
{
static void Main(string[] args)
{
//Create a Presentation instance
Presentation ppt = new Presentation();
//Load the PowerPoint document
ppt.LoadFromFile("SmartArt.pptx");
//Get the first slide
ISlide slide = ppt.Slides[0];
//Get the SmartArt
ISmartArt smartArt = slide.Shapes[0] as ISmartArt;
//Add hyperlink to the first node of the SmartArt to link to a web page
smartArt.Nodes[0].Click = new ClickHyperlink("https://www.e-iceblue.com");
//Add hyperlink to the first node of the SmartArt to link to a specific slide
smartArt.Nodes[1].Click = new ClickHyperlink(ppt.Slides[1]);
//Save the result document
ppt.SaveToFile("Result.pptx", FileFormat.Pptx2013);
}
}
}
VB.NET
Imports Spire.Presentation
Imports Spire.Presentation.Diagrams
Namespace SmartArt
Class Program
Private Shared Sub Main(ByVal args As String())
Dim ppt As Presentation = New Presentation()
ppt.LoadFromFile("SmartArt.pptx")
Dim slide As ISlide = ppt.Slides(0)
Dim smartArt As ISmartArt = TryCast(slide.Shapes(0), ISmartArt)
smartArt.Nodes(0).Click = New ClickHyperlink("https://www.e-iceblue.com")
smartArt.Nodes(1).Click = New ClickHyperlink(ppt.Slides(1))
ppt.SaveToFile("Result.pptx", FileFormat.Pptx2013)
End Sub
End Class
End Namespace
Output:

Published in
SmartArt
Tagged under
We have demonstrated how to use Spire.Doc for Java to add text watermark and image watermark to word document. This article will show you how to add WordArt to the Word header to get the multiple watermarks on the Word document:
Insert multiple text watermarks to Word
import com.spire.doc.Document;
import com.spire.doc.FileFormat;
import com.spire.doc.HeaderFooter;
import com.spire.doc.Section;
import com.spire.doc.documents.Paragraph;
import com.spire.doc.documents.ShapeLineStyle;
import com.spire.doc.documents.ShapeType;
import com.spire.doc.fields.ShapeObject;
import java.awt.*;
public class WordWatermark {
public static void main(String[] args) {
//Load the sample document
Document doc = new Document();
doc.loadFromFile("Sample.docx");
//Add WordArt shape and set the size
ShapeObject shape = new ShapeObject(doc, ShapeType.Text_Plain_Text);
shape.setWidth(60);
shape.setHeight(20);
//Set the text, position and sytle for the wordart
shape.setVerticalPosition(30);
shape.setHorizontalPosition(20);
shape.setRotation(315);
shape.getWordArt().setText("Confidential");
shape.setFillColor(Color.red);
shape.setLineStyle(ShapeLineStyle.Single);
shape.setStrokeColor(new Color(192, 192, 192, 255));
shape.setStrokeWeight(1);
Section section;
HeaderFooter header;
for (int n = 0; n < doc.getSections().getCount(); n++) {
section = doc.getSections().get(n);
//Get the header of section
header = section.getHeadersFooters().getHeader();
Paragraph paragraph1;
for (int i = 0; i < 4; i++) {
//Add the hearder to the paragraph
paragraph1 = header.addParagraph();
for (int j = 0; j < 3; j++) {
//copy the word are and add it to many places
shape = (ShapeObject) shape.deepClone();
shape.setVerticalPosition(50 + 150 * i);
shape.setHorizontalPosition(20 + 160 * j);
paragraph1.getChildObjects().add(shape);
}
}
}
//Save the document to file
doc.saveToFile("Result.docx", FileFormat.Docx_2013);
}
}
Effective screenshot:

Published in
Watermark
Tagged under