//// This code is part of Document Solutions for Word demos.// Copyright (c) MESCIUS inc. All rights reserved.//usingSystem.IO;usingSystem.Diagnostics;usingGrapeCity.Documents.Word; namespaceDsWordWeb.Demos{// This demo shows how to add an SVG image to am MS Word DOCX document.publicclassAddSvg {publicGcWordDocumentCreateDocx() {var doc = newGcWordDocument();var par = doc.Body.AddParagraph("The picture below is produced by a vector SVG image added to the document. " +"Mimicking the MS Word behavior, when an SVG is added, DsWord also creates a fallback raster version of the image."); var pic = doc.Body.AddParagraph().AddRun().AddPicture();// Load picture data:var picBytes = File.ReadAllBytes(Path.Combine("Resources", "SVG", "Smiling-Girl.svg")); pic.ImageData.SetImage(picBytes, "image/svg+xml"); // In a debug configuration this shows that both vector and raster image versions are present:Debug.Assert(pic.ImageData.ImageBytes != null);Debug.Assert("image/png" == pic.ImageData.ContentType);Debug.Assert(pic.ImageData.ComplementaryVectorData != null);Debug.Assert(pic.ImageData.ComplementaryVectorData.ImageBytes.Length > 0);Debug.Assert("image/svg+xml" == pic.ImageData.ComplementaryVectorData.ContentType); // Specify the picture size: pic.Size.Width.Value = 200; pic.Size.Height.Value = 400; doc.Body.AddParagraph("The End."); // Done:return doc; } }}