title: Get text with correct font from pptx with Openxml
body: <p>I use these methods to get the text:</p>
  
  <pre><code>public static string[] GetAllTextInSlide(SlidePart slidePart)
      {
          // Verify that the slide part exists.
          if (slidePart == null)
          {
              throw new ArgumentNullException("slidePart");
          }
  
          // Create a new linked list of strings.
          LinkedList&lt;string&gt; texts = new LinkedList&lt;string&gt;();
  
          // If the slide exists...
          if (slidePart.Slide != null)
          {
              // Iterate through all the paragraphs in the slide.
              foreach (var paragraph in slidePart.Slide.Descendants&lt;DocumentFormat.OpenXml.Drawing.Paragraph&gt;())
              {
                  // Create a new string builder.                    
                  StringBuilder paragraphText = new StringBuilder();
  
                  // Iterate through the lines of the paragraph.
                  foreach (var text in paragraph.Descendants&lt;DocumentFormat.OpenXml.Drawing.Text&gt;())
                  {
                      // Append each line to the previous lines.
                      paragraphText.Append(text.Text);
                  }
  
                  if (paragraphText.Length &gt; 0)
                  {
                      // Add each paragraph to the linked list.
                      texts.AddLast(paragraphText.ToString());
                  }
              }
          }
  
          if (texts.Count &gt; 0)
          {
              // Return an array of strings.
              return texts.ToArray();
          }
          else
          {
              return null;
          }
      }
  </code></pre>
  
  <p>and </p>
  
  <pre><code>public static string[] GetAllTextInSlide(PresentationDocument presentationDocument, int slideIndex)
      {
          // Verify that the presentation document exists.
          if (presentationDocument == null)
          {
              throw new ArgumentNullException("presentationDocument");
          }
  
          // Verify that the slide index is not out of range.
          if (slideIndex &lt; 0)
          {
              throw new ArgumentOutOfRangeException("slideIndex");
          }
  
          // Get the presentation part of the presentation document.
          PresentationPart presentationPart = presentationDocument.PresentationPart;
  
          // Verify that the presentation part and presentation exist.
          if (presentationPart != null &amp;&amp; presentationPart.Presentation != null)
          {
              // Get the Presentation object from the presentation part.
              Presentation presentation = presentationPart.Presentation;
  
              // Verify that the slide ID list exists.
              if (presentation.SlideIdList != null)
              {
                  // Get the collection of slide IDs from the slide ID list.
                  var slideIds = presentation.SlideIdList.ChildElements;
  
                  // If the slide ID is in range...
                  if (slideIndex &lt; slideIds.Count)
                  {
                      // Get the relationship ID of the slide.
                      string slidePartRelationshipId = (slideIds[slideIndex] as SlideId).RelationshipId;
  
                      // Get the specified slide part from the relationship ID.
                      SlidePart slidePart = (SlidePart)presentationPart.GetPartById(slidePartRelationshipId);
  
                      // Pass the slide part to the next method, and then return the array of strings that method returns to the previous method.
                      return GetAllTextInSlide(slidePart);
                  }
              }
          }
          // Else, return null.
          return null;
      }
  </code></pre>
  
  <p>but they just give me the words. How can I get the text with the correct font and color?</p>