Document Solutions for Word
Features / Shapes / Ink Shape
In This Topic
    Ink Shape
    In This Topic

    Ink shapes are user-drawn shapes which can include lines and curves.

    DsWord supports ink shapes which can be added by using Add and Insert methods of InkShapeCollection class. You can also access the previous or next ink shapes and get the xml document containing ink shape's content by using various methods provided by InkShape class.

    In DsWord, you can create a new ink shape by providing an xml document which describes ink drawing or load a document with predefined ink shapes.

    Modify Ink Shape

    To modify an existing ink shape in a document:

    1. Load the document containing ink shape using Load method of GcWordDocument class.
    2. Access the ink shape by using InkShapes property of RangeBase class.
    3. Modify ink shape by setting various properties of ShapeBase class like AlternativeText, Rotation, Title, Height and Width etc
      C#
      Copy Code
      var doc = new GcWordDocument();
      
      //Load doc containing ink shape
      doc.Load("ink.docx");
      
      if (doc.Body.InkShapes.Count == 0)
          return;
              
      //Access first ink shape
      var ink = doc.Body.InkShapes.First;
      
      //Modify Ink shape
      ink.BlackWhiteMode = BlackWhiteMode.LightGray;
      ink.AlternativeText = "xyz";
      ink.Rotation.HorizontalFlip = true;
      ink.Title = "ink shape title";
      ink.Size.Height.Value = 300;
      ink.Size.Width.Value = 100;
      
      //Save document
      doc.Save("InkShapeModified.docx");   
    Back to Top