title: Open XML: Align the text which is indented
body: <p>In the image the second line number(s) text is aligned to 6. instead of according.</p>
  
  <p><a href="https://i.stack.imgur.com/SY2gc.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SY2gc.jpg" alt="enter image description here"></a></p>
  
  <p>I am writing text into word document using Open XML word processing Document. Whenever I have an indent the text is not aligning properly after the indented number. How to align the text to the first line of text instead aligning to the indent ?</p>
  
  <pre><code>Please find the below code
  
  //bullets 6 and 7 text to be written in word document
  string value = "6.   According to the latest available equalized assessment roll in the office of the county tax assessor, the assessor's parcel number(s) for the above-mentioned legal description is/are _________, which also include(s) other property.
  7.   Appurtenant _________ easement in common with others in accordance with the terms and conditions relative to the use thereof.";
  //bookmark
  string name = "COMEXCEPTIONS";
  string[] newLineArray = { Environment.NewLine, "\n" };
   var bookMark = Document.MainDocumentPart.Document.Body.Descendants&lt;BookmarkStart&gt;().Where(bm =&gt; bm.Name.ToString().ToUpper() == name);
  foreach (BookmarkStart bm in bookMark)
                      {
                          if (bm.Name.ToString().ToUpper() == name.ToUpper())
                          {
                              var textReplacementPending = true;
                              Run sib = bm.NextSibling&lt;Run&gt;();
                              if (sib == null)
                              {
                                  bool isEmptyField = false; 
                                  if (!IsFormFiled)
                                  {
                                      isEmptyField = name.Equals(value);
                                  }
  
                                  WordToolKitExtension wd = new WordToolKitExtension();
                                  wd.SetBookmarkText(bm, value, !isEmptyField);
                              }
  
  
                              while (textReplacementPending &amp;&amp; sib != null)
                              {
  
                                  var fieldChars = sib.Descendants&lt;FieldChar&gt;();
                                  foreach (FieldChar fieldChar in fieldChars)
                                  {
  
                                      if (fieldChar.FieldCharType == FieldCharValues.Separate)
                                      {
                                          if (!IsFormFiled)
                                          {
                                              RunProperties runProperties17 = new RunProperties();
                                              Color color10 = new Color() { Val = "FF0000" };
                                              runProperties17.Append(color10);
                                              sib.Append(runProperties17);
                                          }
  
                                          Text text12 = new Text();
                                          if (name.ToUpper() == POLICY_DAY.ToUpper() ||
                                              name.ToUpper() == POLICY_MONTH.ToUpper())
                                              text12.Text = !string.IsNullOrEmpty(value) ? value.ToUpper() : value;
                                          else
                                          {
                                              text12.Text = value;
                                          }
  
  
  
                                          if (!string.IsNullOrEmpty(value) &amp;&amp; value.Split(newLineArray, StringSplitOptions.None).Count() &lt;= 1)
                                          {
                                              sib.Append(text12);
                                              try
                                              {
  
                                                  OpenXmlElement elem = sib.NextSibling();
                                                  //if (sib.Descendants&lt;OpenXmlElement&gt;() != null)
                                                  //    k = sib.Descendants&lt;OpenXmlElement&gt;().Count();
                                                  while (elem != null &amp;&amp; !(elem is BookmarkEnd))
                                                  {
                                                      OpenXmlElement nextElem = elem.NextSibling();
  
                                                      if (nextElem.ChildElements.Count &gt; 0)
                                                      {
                                                          elem.Remove();
                                                          elem = nextElem;
                                                      }
                                                      else
                                                          return;
                                                  }
                                              }
                                              catch (Exception ex)
                                              {
  
                                              }
                                          }
                                          else
                                              if (!string.IsNullOrEmpty(value))
                                                  ParseForOpenXML(ref sib, value);
                                          textReplacementPending = false;
                                          return;
                                      }
                                  }
                                  sib = sib.NextSibling&lt;Run&gt;();
                                  if (sib == null)
                                      return;
  
                              }
                          }
                      }
  
  
  
  public void ParseForOpenXML(ref Run run, string textualData)
          {
              try
              {
                  string[] newLineArray = { Environment.NewLine, "\n" };
                  string[] textArray = textualData.Split(newLineArray, StringSplitOptions.None);
                  bool first = true;
                  foreach (string line in textArray)
                  {
                      if (!first)
                      {
                          run.Append(new Break());
                      }
  
                      first = false;
  
                      Text txt = new Text();
                      txt.Text = line;
                      run.Append(txt);
                  }
              }
              catch (Exception ex)
              {
                  throw ex);
              }
          }
  </code></pre>