// Copyright (c) MESCIUS inc. All rights reserved.
//
usingSystem;
usingSystem.IO;
usingSystem.Drawing;
usingSystem.Linq;
usingSystem.Diagnostics;
usingGrapeCity.Documents.Word;
usingGrapeCity.Documents.Imaging;
namespaceDsWordWeb.Demos
{
// This demo shows how to add a link to a YouTube video that plays in the DOCX.
publicclassAddVideoLink
{
publicGcWordDocumentCreateDocx()
{
var doc =newGcWordDocument();
doc.Body.AddParagraph("The picture below includes a link to a YouTube video which plays inside the document if clicked.");
// Add picture with a thumbnail and a video link inside:
var vStyle = doc.Styles.Add("vlink_style", doc.Styles[BuiltInStyleId.BlockText]);
vStyle.ParagraphFormat.Indentation.LeftIndent=0;
var par = doc.Body.AddParagraph();
par.Style= vStyle;
var pic = par.AddRun().AddPicture();
var picBytes =File.ReadAllBytes(Path.Combine("Resources","ImagesBis","mescius-video-thumbnail.jpg"));
pic.ImageData.SetImage(picBytes,"image/jpeg");
pic.ImageData.WebVideoProperties.SetUrl("https://www.youtube.com/watch?v=RRTCt2TTOyU","How to Build a Simple Balance Sheet using C# .NET Excel APIs",400,400);