//
// This code is part of Document Solutions for Word demos.
// Copyright (c) MESCIUS inc. All rights reserved.
//
using System;
using System.IO;
using System.Drawing;
using System.Collections.Generic;
using System.Linq;
using System.Xml;
using GrapeCity.Documents.Word;
namespace DsWordWeb.Demos
{
// This demo shows how to associate hyperlink behavior with a shape in a DOCX.
public class HyperlinkAction
{
public GcWordDocument CreateDocx()
{
var doc = new GcWordDocument();
var run = doc.Body.AddParagraph().AddRun();
var shape = run.GetRange().Shapes.Add(200, 200, GeometryType.Pentagon);
shape.Fill.Type = FillType.Solid;
shape.Fill.SolidFill.RGB = Color.Coral;
shape.Line.Width = 3;
shape.Line.Fill.SolidFill.RGB = Color.CadetBlue;
shape.AddTextFrame("This shape has HyperlinkOnClick and HyperlinkOnHover properties specified.");
shape.Size.EffectExtent.AllEdges = 8;
// HyperlinkOnClick properties:
shape.HyperlinkOnClick.Address = new Uri("https://www.google.com/maps", UriKind.RelativeOrAbsolute);
shape.HyperlinkOnClick.ScreenTip = "Go to Google Maps";
shape.HyperlinkOnClick.HighlightClick = true;
// HyperlinkOnHover properties:
shape.HyperlinkOnHover.Address = new Uri("https://www.google.com", UriKind.RelativeOrAbsolute);
shape.HyperlinkOnHover.ScreenTip = "Just Google";
shape.HyperlinkOnHover.HighlightClick = true;
// Done:
return doc;
}
}
}