Paragraph and Text

Paragraph and Text (20)

Wednesday, 04 September 2019 07:38

Set 3D effect for the text in PowerPoint in C#

Written by support iceblue

With the help of Spire.Presentation for .NET, we could set 3D effect to the shapes and text in the PowerPoint document to make it attractive. We have already demonstrated how to use Spire.Presentation to set 3D format for shapes. In this article, I will introduce how to create three dimensional effects text in PowerPoint in C#.

using Spire.Presentation;
using Spire.Presentation.Drawing;
using System.Drawing;

namespace 3DEffectForText
{
    class Program
    {
        static void Main(string[] args)
        {
            //Create a new presentation object
            Presentation presentation = new Presentation();

            //Get the first slide
            ISlide slide = presentation.Slides[0];

            //Append a new shape to slide and set the line color and fill type
            IAutoShape shape = slide.Shapes.AppendShape(ShapeType.Rectangle, new RectangleF(30, 40, 600, 200));
            shape.ShapeStyle.LineColor.Color = Color.White;
            shape.Fill.FillType = Spire.Presentation.Drawing.FillFormatType.None;

            //Add text to the shape
            shape.AppendTextFrame("This demo shows how to add 3D effect text to Presentation slide");

            //set the color of text in shape
            TextRange textRange = shape.TextFrame.TextRange;
            textRange.Fill.FillType = Spire.Presentation.Drawing.FillFormatType.Solid;
            textRange.Fill.SolidColor.Color = Color.Green;

            //set the Font of text in shape
            textRange.FontHeight = 30;
            textRange.LatinFont = new TextFont("Gulim");


            //Set 3D effect for text
            shape.TextFrame.TextThreeD.ShapeThreeD.PresetMaterial = PresetMaterialType.Matte;
            shape.TextFrame.TextThreeD.LightRig.PresetType = PresetLightRigType.Sunrise;
            shape.TextFrame.TextThreeD.ShapeThreeD.TopBevel.PresetType = BevelPresetType.Circle;
            shape.TextFrame.TextThreeD.ShapeThreeD.ContourColor.Color = Color.Green;
            shape.TextFrame.TextThreeD.ShapeThreeD.ContourWidth = 3;                    
          
            //Save the document to file.
            presentation.SaveToFile("3DEffectForText_result.pptx", FileFormat.Pptx2010);                                                        
        }
    }
}

Effective screenshot for 3-D effect text on Presentation slides:

Set 3D effect for the text in PowerPoint in C#

This article demonstrates how to add a picture as a custom bullet style in a PowerPoint file using Spire.Presentation.

Below is the screenshot of the example PowerPoint file:

Add a Picture as a Custom Bullet Style in PowerPoint in C#

Detail steps:

Step 1: Instantiate a Presentation object and load the PowerPoint file.

Presentation ppt = new Presentation();
ppt.LoadFromFile(@"Input.pptx");

Step 2: Get the first shape on the first slide.

IAutoShape shape = ppt.Slides[0].Shapes[0] as IAutoShape;

Step 3: Add a picture as the bullet style of the paragraphs in the shape.

foreach (TextParagraph paragraph in shape.TextFrame.Paragraphs)
{
    paragraph.BulletType = TextBulletType.Picture;
    Image bulletPicture = Image.FromFile(@"timg.jpg");
    paragraph.BulletPicture.EmbedImage = ppt.Images.Append(bulletPicture);
}

Step 4: Save the file.

ppt.SaveToFile(@"Output.pptx", FileFormat.Pptx2010);

Screenshot:

Add a Picture as a Custom Bullet Style in PowerPoint in C#

Full code:

using System.Drawing;
using Spire.Presentation;

namespace Add_Picture_as_Custom_Bullet_Style_in_PPT
{
    class Program
    {
        static void Main(string[] args)
        {
            //Instantiate a Presentation object
            Presentation ppt = new Presentation();
            //Load the PowerPoint file
            ppt.LoadFromFile(@"Input.pptx");

            //Get the first shape on the first slide
            IAutoShape shape = ppt.Slides[0].Shapes[0] as IAutoShape;

            //Traverse through the paragraphs in the shape
            foreach (TextParagraph paragraph in shape.TextFrame.Paragraphs)
            {
                //Set the bullet style of paragraph as picture
                paragraph.BulletType = TextBulletType.Picture;
                //Load a picture
                Image bulletPicture = Image.FromFile(@"timg.jpg");
                //Add the picture as the bullet style of paragraph
                paragraph.BulletPicture.EmbedImage = ppt.Images.Append(bulletPicture);
            }

            //Save the file
            ppt.SaveToFile(@"Output.pptx", FileFormat.Pptx2010);
        }
    }
}

We have already demonstrated how to use Spire.Presentation to insert HTML formatted text to PowerPoint slide. Now from Spire.Presentation 3.4.1, it supports to insert html (including text, image, audio and video) into presentation slides and each html tag will be added to the slide as a separate shape. The following code snippets demonstrate how to.

Step 1: Create an instance of Presentation class.

Presentation ppt = new Presentation();

Step 2: Get the shapes on the first slide.

ShapeList shapes = ppt.Slides[0].Shapes;

Step 3: Add contents to shape from HTML code, which includes text and image.

shapes.AddFromHtml("<html><div><p>First paragraph</p><p><img src='https://cdn.e-iceblue.com/Logo.jpg'/></p><p>Second paragraph </p></html>");

Step 4: Save the document to file.

ppt.SaveToFile("Result.pptx", FileFormat.Pptx2010);

Effective screenshot:

Insert HTML with image into the Presentation slides in C#

Full codes of how to insert HTML into the Presentation slides:

Presentation ppt = new Presentation();

ShapeList shapes = ppt.Slides[0].Shapes;
            
shapes.AddFromHtml("<html><div><p>First paragraph</p><p><img src='https://cdn.e-iceblue.com/Logo.jpg'/></p><p>Second paragraph </p></html>");

ppt.SaveToFile("Result.pptx", FileFormat.Pptx2010);
Wednesday, 07 February 2018 09:36

Auto-Fit Text or Shape in PowerPoint in C#, VB.NET

Written by support iceblue

With auto-fit feature, you can automatically reduce the font size of text to fit a shape, or you can shrink or enlarge shape to fit the exact size of your text. This article will show you how to auto-fit text or shape using Spire.Presentation with C#, VB.NET.

Step 1: Create an instance of Presentation class.

Presentation presentation = new Presentation();

Step 2: Insert a shape, and set the AutofitType property to Normal, which means the text automatically shrinks to fit shape.

IAutoShape textShape1 = presentation.Slides[0].Shapes.AppendShape(ShapeType.Rectangle, new RectangleF(50, 50, 150, 80));
textShape1.TextFrame.Text = "Shrink text to fit shape. Shrink text to fit shape. Shrink text to fit shape. Shrink text to fit shape.";
textShape1.TextFrame.AutofitType = TextAutofitType.Normal;

Step 3: Insert a shape, and set the AutofitType property to Shape, which means the shape size automatically decreases or increases to fit text.

IAutoShape textShape2 = presentation.Slides[0].Shapes.AppendShape(ShapeType.Rectangle, new RectangleF(350, 50, 150, 80));
textShape2.TextFrame.Text = "Resize shape to fit text.";
textShape2.TextFrame.AutofitType = TextAutofitType.Shape;

Step 4: Save the file.

presentation.SaveToFile("output.pptx", FileFormat.Pptx2013);

Output:

Auto-Fit Text or Shape in PowerPoint in C#, VB.NET

Full Code:

[C#]
Presentation presentation = new Presentation();

IAutoShape textShape1 = presentation.Slides[0].Shapes.AppendShape(ShapeType.Rectangle, new RectangleF(50, 50, 150, 80));
textShape1.TextFrame.Text = "Shrink text to fit shape. Shrink text to fit shape. Shrink text to fit shape. Shrink text to fit shape.";
textShape1.TextFrame.AutofitType = TextAutofitType.Normal;

IAutoShape textShape2 = presentation.Slides[0].Shapes.AppendShape(ShapeType.Rectangle, new RectangleF(350, 50, 150, 80));
textShape2.TextFrame.Text = "Resize shape to fit text.";
textShape2.TextFrame.AutofitType = TextAutofitType.Shape;

presentation.SaveToFile("output.pptx", FileFormat.Pptx2013);
[VB.NET]
Dim presentation As Presentation =  New Presentation() 

Dim textShape1 As IAutoShape =  presentation.Slides(0).Shapes.AppendShape(ShapeType.Rectangle,New RectangleF(50,50,150,80)) 
textShape1.TextFrame.Text = "Shrink text to fit shape. Shrink text to fit shape. Shrink text to fit shape. Shrink text to fit shape."
textShape1.TextFrame.AutofitType = TextAutofitType.Normal
Dim textShape2 As IAutoShape =  presentation.Slides(0).Shapes.AppendShape(ShapeType.Rectangle,New RectangleF(350,50,150,80)) 
textShape2.TextFrame.Text = "Resize shape to fit text."
textShape2.TextFrame.AutofitType = TextAutofitType.Shape
presentation.SaveToFile("output.pptx", FileFormat.Pptx2013)

Spire.Presentation supports to operate the paragraph styles from code. There are two kinds of special indentation styles for the paragraph, first line and hanging. This article will demonstrate how to set the indent style for the paragraph on presentation slide in C#.

Step 1: Create an instance of presentation and load the document from file.

Presentation presentation = new Presentation();
presentation.LoadFromFile("Sample.pptx");

Step 2: Get the paragraphs from the first slide.

IAutoShape shape = (IAutoShape)presentation.Slides[0].Shapes[0];
ParagraphCollection paras = shape.TextFrame.Paragraphs;

Step 3: Set the indentation as first line for the first paragraph.

paras[0].Indent = 20;
paras[0].SpaceAfter = 10;

Step 4: Set the indentation as Hanging for the third paragraph.

paras[2].Indent = -100;
paras[2].LeftMargin = 30;

Step 5: Save the document to file.

presentation.SaveToFile("Result.pptx", FileFormat.Pptx2010);

Effective screenshot of the presentation with indentation style:

How to set the indent style for the paragraph on presentation slide in C#

Full codes:

Presentation presentation = new Presentation();
presentation.LoadFromFile("Sample.pptx");

IAutoShape shape = (IAutoShape)presentation.Slides[0].Shapes[0];
ParagraphCollection paras = shape.TextFrame.Paragraphs;

paras[0].Indent = 20;
paras[0].SpaceAfter = 10;

paras[2].Indent = -100;
paras[2].LeftMargin = 30;

presentation.SaveToFile("Result.pptx", FileFormat.Pptx2010);
Thursday, 07 December 2017 08:44

Apply Transparency to Text in PowerPoint in C#, VB.NET

Written by jie zou

It is possible to add text transparency to any text shape in PowerPoint. In order to make the text transparent, we’d need to apply the transparency level to the text shape. This article will show you how to set the transparency level of text using Spire.Presentation.

Step 1: Create a Presentation instance.

Presentation ppt = new Presentation();

Step 2: Add a shape to the first slide.

IAutoShape textboxShape = ppt.Slides[0].Shapes.AppendShape(ShapeType.Rectangle, new RectangleF(50, 70,300, 120));
textboxShape.ShapeStyle.LineColor.Color = Color.Transparent;
textboxShape.Fill.FillType = FillFormatType.None;

Step 3: Add text to shape.

textboxShape.TextFrame.Text = "Text Transparency";

Step 4: Set the fill type of TextRange to solid, and fill the TextRange using the color created with specified alpha value.

textboxShape.TextFrame.TextRange.Fill.FillType = FillFormatType.Solid;
int alpha = 55;
textboxShape.TextFrame.TextRange.Fill.SolidColor.Color = Color.FromArgb(alpha, Color.Purple);

Step 5:Save the file.

ppt.SaveToFile("result.pptx", FileFormat.Pptx2013);

Output:

Apply Transparency to Text in PowerPoint in C#, VB.NET

Full Code:

[C#]
//create a PowerPoint document
Presentation ppt = new Presentation();
ppt.SlideSize.Type = SlideSizeType.Screen16x9;

//add a shape
IAutoShape textboxShape = ppt.Slides[0].Shapes.AppendShape(ShapeType.Rectangle, new RectangleF(50, 70,300, 120));
textboxShape.ShapeStyle.LineColor.Color = Color.Transparent;
textboxShape.Fill.FillType = FillFormatType.None;

//remove default blank paragraphs
textboxShape.TextFrame.Paragraphs.Clear();

//add three paragraphs, apply color with different alpha values to text
int alpha = 55;
for (int i = 0; i < 3; i++)
{
    textboxShape.TextFrame.Paragraphs.Append(new TextParagraph());
    textboxShape.TextFrame.Paragraphs[i].TextRanges.Append(new TextRange("Text Transparency"));
    textboxShape.TextFrame.Paragraphs[i].TextRanges[0].Fill.FillType = FillFormatType.Solid;
    textboxShape.TextFrame.Paragraphs[i].TextRanges[0].Fill.SolidColor.Color = Color.FromArgb(alpha, Color.Purple);
    alpha += 100;
}

//save to file
ppt.SaveToFile("result.pptx", FileFormat.Pptx2013); 
[VB.NET]
'create a PowerPoint document
Dim ppt As Presentation = New Presentation()
ppt.SlideSize.Type = SlideSizeType.Screen16x9
 
'add a shape
Dim textboxShape As IAutoShape = ppt.Slides(0).Shapes.AppendShape(ShapeType.Rectangle, New RectangleF(50, 70, 300, 120))
textboxShape.ShapeStyle.LineColor.Color = Color.Transparent
textboxShape.Fill.FillType = FillFormatType.None
 
'remove default blank paragraphs
textboxShape.TextFrame.Paragraphs.Clear()
 
'add three paragraphs, apply color with different alpha values to text
Dim alpha As Integer = 55
Dim i As Integer
For i = 0 To  3- 1  Step i + 1
    textboxShape.TextFrame.Paragraphs.Append(New TextParagraph())
    textboxShape.TextFrame.Paragraphs(i).TextRanges.Append(New TextRange("Text Transparency"))
    textboxShape.TextFrame.Paragraphs(i).TextRanges(0).Fill.FillType = FillFormatType.Solid
    textboxShape.TextFrame.Paragraphs(i).TextRanges(0).Fill.SolidColor.Color = Color.FromArgb(alpha, Color.Purple)
    alpha += 100
Next
 
'save to file
ppt.SaveToFile("result.pptx", FileFormat.Pptx2013)

You may sometimes want your text to display vertically (letters stacked one on top of the other), horizontally, or rotated facing the right margin or the left margin. This tutorial shows you how to change the text direction using VerticalTextType property in Spire.Presentation.

Step 1: Initialize an instance of Prensentation class.

Presentation ppt = new Presentation();

Step 2: Append a shape with text to the first slide.

IAutoShape textboxShape = ppt.Slides[0].Shapes.AppendShape(ShapeType.Rectangle, new RectangleF(50, 70, 100, 400));
textboxShape.ShapeStyle.LineColor.Color = Color.Transparent;
textboxShape.Fill.FillType = Spire.Presentation.Drawing.FillFormatType.Solid;
textboxShape.Fill.SolidColor.Color = Color.OrangeRed;
textboxShape.TextFrame.Text = "You Are Welcome Here";

Step 3: Set the text direction to vertical.

textboxShape.TextFrame.VerticalTextType = VerticalTextType.Vertical;

Step 4: Append another shape with text to the slide.

textboxShape = ppt.Slides[0].Shapes.AppendShape(ShapeType.Rectangle, new RectangleF(150, 70, 100, 400));
textboxShape.ShapeStyle.LineColor.Color = Color.Transparent;
textboxShape.Fill.FillType = Spire.Presentation.Drawing.FillFormatType.Solid;
textboxShape.Fill.SolidColor.Color = Color.Orange;
textboxShape.TextFrame.Text = "欢迎光临";

Step 5: For asian characters, you can set the VerticalTextType as EastAsianVertical to aviod rotating text 90 degrees.

textboxShape.TextFrame.VerticalTextType = VerticalTextType.EastAsianVertical;

Step 6: Save the file.

ppt.SaveToFile("output.pptx", FileFormat.Pptx2013);

Output:

How to Change Text Direction in PowerPoint in C#, VB.NET

Full Code:

[C#]
Presentation ppt = new Presentation();

IAutoShape textboxShape = ppt.Slides[0].Shapes.AppendShape(ShapeType.Rectangle, new RectangleF(50, 70, 100, 400));
textboxShape.ShapeStyle.LineColor.Color = Color.Transparent;
textboxShape.Fill.FillType = Spire.Presentation.Drawing.FillFormatType.Solid;
textboxShape.Fill.SolidColor.Color = Color.OrangeRed;
textboxShape.TextFrame.Text = "You Are Welcome Here";
textboxShape.TextFrame.VerticalTextType = VerticalTextType.Vertical;

textboxShape = ppt.Slides[0].Shapes.AppendShape(ShapeType.Rectangle, new RectangleF(150, 70, 100, 400));
textboxShape.ShapeStyle.LineColor.Color = Color.Transparent;
textboxShape.Fill.FillType = Spire.Presentation.Drawing.FillFormatType.Solid;
textboxShape.Fill.SolidColor.Color = Color.Orange;
textboxShape.TextFrame.Text = "欢迎光临";
textboxShape.TextFrame.VerticalTextType = VerticalTextType.EastAsianVertical;

ppt.SaveToFile("output.pptx", FileFormat.Pptx2013);
[VB.NET]
Dim ppt As New Presentation()

Dim textboxShape As IAutoShape = ppt.Slides(0).Shapes.AppendShape(ShapeType.Rectangle, New RectangleF(50, 70, 100, 400))
textboxShape.ShapeStyle.LineColor.Color = Color.Transparent
textboxShape.Fill.FillType = Spire.Presentation.Drawing.FillFormatType.Solid
textboxShape.Fill.SolidColor.Color = Color.OrangeRed
textboxShape.TextFrame.Text = "You Are Welcome Here"
textboxShape.TextFrame.VerticalTextType = VerticalTextType.Vertical

textboxShape = ppt.Slides(0).Shapes.AppendShape(ShapeType.Rectangle, New RectangleF(150, 70, 100, 400))
textboxShape.ShapeStyle.LineColor.Color = Color.Transparent
textboxShape.Fill.FillType = Spire.Presentation.Drawing.FillFormatType.Solid
textboxShape.Fill.SolidColor.Color = Color.Orange
textboxShape.TextFrame.Text = "欢迎光临"
textboxShape.TextFrame.VerticalTextType = VerticalTextType.EastAsianVertical

ppt.SaveToFile("output.pptx", FileFormat.Pptx2013)

Spire.Presentation supports to insert HTML formatted text to PowerPoint slide. The following code snippets demonstrate how to.

Step 1: Create an instance of Presentation class.

Presentation ppt = new Presentation();

Step 2: Insert an autoshape (rectangle) in slide.

IAutoShape shape = ppt.Slides[0].Shapes.AppendShape(ShapeType.Rectangle, new RectangleF(50, 50, 400, 100));

Step 3: Clear default paragraphs in the shape.

shape.TextFrame.Paragraphs.Clear();

Step 4: Add paragraphs to shape from HTML code. Make sure your HTML segments are written between <html><body> and </body></html> tags, otherwise, AddFromHtml method will fail to work.

string htmlText= "<html><body><p>First paragraph</p><p>Second paragraph</p></body></html>";
shape.TextFrame.Paragraphs.AddFromHtml(htmlText);

Step 5: Save to file.

ppt.SaveToFile("output.pptx", FileFormat.Pptx2013);

Output:

Append HTML String to PowerPoint in C#, VB.NET

Full Code:

[C#]
Presentation ppt = new Presentation();
IAutoShape shape = ppt.Slides[0].Shapes.AppendShape(ShapeType.Rectangle, new RectangleF(50, 50, 400, 100));
shape.TextFrame.Paragraphs.Clear();

string htmlText= "<html><body><p>First paragraph</p><p>Second paragraph</p></body></html>";
shape.TextFrame.Paragraphs.AddFromHtml(htmlText);

ppt.SaveToFile("output.pptx", FileFormat.Pptx2013);
[VB.NET]
Dim ppt As New Presentation()
Dim shape As IAutoShape = ppt.Slides(0).Shapes.AppendShape(ShapeType.Rectangle, New RectangleF(50, 50, 400, 100))
shape.TextFrame.Paragraphs.Clear()

Dim htmlText As String = "<html><body><p>First paragraph</p><p>Second paragraph</p></body></html>";
shape.TextFrame.Paragraphs.AddFromHtml(htmlText)

ppt.SaveToFile("output.pptx", FileFormat.Pptx2013)

In our daily work, we may need to copy the contents from one presentation slides to another. This article is aimed to introduce the method of how to copy the content from one paragraph from the source PowerPoint document to the target document by using Spire.Presenation.

Firstly, View the original presentation slide and the target presentation slide.

Copy a paragraph from one presentation slide to another in C#

Step 1: Initialize an instances of Presentation class and load the source document from file

Presentation ppt = new Presentation();
ppt.LoadFromFile("Sample.pptx", FileFormat.Pptx2010);

Step 2: Get the text from the first shape on the first slide.

string Text = "";           
IShape shp = ppt.Slides[0].Shapes[0];
Text = ((IAutoShape)shp).TextFrame.Text;

Step 3: Get the first shape on the first slide from the target document file.

Presentation ppt2 = new Presentation("Sample1.pptx", FileFormat.Pptx2010);
IShape destshp = ppt2.Slides[0].Shapes[0];

Step 4: Get text from placeholder.

((IAutoShape)destshp).TextFrame.Text += Text;

Step 5: Save the document to file.

ppt2.SaveToFile("Sample1.pptx", FileFormat.Pptx2010);

Effective screenshot after copy the paragraph from the source file:

Copy a paragraph from one presentation slide to another in C#

Full codes:

{
    Presentation ppt = new Presentation();
    ppt.LoadFromFile("Sample.pptx", FileFormat.Pptx2010);

    string Text = "";
    IShape shp = ppt.Slides[0].Shapes[0];
    Text = ((IAutoShape)shp).TextFrame.Text;
   
    Presentation ppt2 = new Presentation("Sample1.pptx", FileFormat.Pptx2010);
    IShape destshp = ppt2.Slides[0].Shapes[0];
    ((IAutoShape)destshp).TextFrame.Text += Text;
    
    ppt2.SaveToFile("Sample1.pptx", FileFormat.Pptx2010);
}

By using Spire.Presentation for .NET, developers can easily modify the texts on the presentation slides. In this topic, we are going to demonstrate how to use Spire.Presentation to replace the specific texts in a placeholder in C#.

Firstly, view the original sample document that the text "Spire.Presentation for .NET" will be replaced later.

Text replacement on the presentation slides

Step 1: Create an instance of Dictionary<string,string> and add an item for the instance.

Dictionary<string, string> TagValues = new Dictionary<string, string>();
TagValues.Add("Spire.Presentation for .NET", "Spire.PPT");

Step 2: Create a presentation instance and load the document from file.

Presentation presentation = new Presentation();
presentation.LoadFromFile("Sample.pptx", FileFormat.Pptx2010);

Step 3: Call ReplaceTags event to replace all the texts on the first slide.

ReplaceTags(presentation.Slides[0], TagValues);

Step 4: Save the document to file and lance to process it.

presentation.SaveToFile("Result.pptx", FileFormat.Pptx2010);
System.Diagnostics.Process.Start("Result.pptx");

The following ReplaceTags() method shows how to replace the text on the first presentation slide:

public void ReplaceTags(Spire.Presentation.ISlide pSlide, Dictionary<string, string> TagValues)
{
    foreach (IShape curShape in pSlide.Shapes)
    {
        if (curShape is IAutoShape)
        {
            foreach (TextParagraph tp in (curShape as IAutoShape).TextFrame.Paragraphs)
            {
                foreach (var curKey in TagValues.Keys)
                {
                    if (tp.Text.Contains(curKey))
                    {
                        tp.Text = tp.Text.Replace(curKey, TagValues[curKey]);
                    }
                }
            }
        }
    }
}

Effective screenshot after the replacing the text on the presentation slide:

Text replacement on the presentation slides

Full codes of how to replace the text on the presentation slides:

public ReplaceText()
{
    {
        Dictionary<string, string> TagValues = new Dictionary<string, string>();
        TagValues.Add("Spire.Presentation for .NET", "Spire.PPT");

        Presentation presentation = new Presentation();

        presentation.LoadFromFile("Sample.pptx", FileFormat.Pptx2010);

        ReplaceTags(presentation.Slides[0], TagValues);

        presentation.SaveToFile("Result.pptx", FileFormat.Pptx2010);
        System.Diagnostics.Process.Start("Result.pptx");
    }
}
public void ReplaceTags(Spire.Presentation.ISlide pSlide, Dictionary<string, string> TagValues)
{
    foreach (IShape curShape in pSlide.Shapes)
    {
        if (curShape is IAutoShape)
        {
            foreach (TextParagraph tp in (curShape as IAutoShape).TextFrame.Paragraphs)
            {
                foreach (var curKey in TagValues.Keys)
                {
                    if (tp.Text.Contains(curKey))
                    {
                        tp.Text = tp.Text.Replace(curKey, TagValues[curKey]);
                    }
                }
            }
        }
    }
}
Page 1 of 2