I want to write text in powerpoint through automation in c#.
I am using Microsoft.Office.Interop.PowerPoint for that.
My sample code:
objSlide = objSlides.Add(1, PowerPoint.PpSlideLayout.ppLayoutCustom);
objTextRng = objSlide.Shapes[1].TextFrame.TextRange;
objTextRng.Text = "first text";
objTextRng.Font.Name = "Calibri";
objTextRng.Font.Size = 20;
objTextRng = objSlide.Shapes[1].TextFrame.TextRange;
objTextRng.Text = "second text";
objTextRng.Font.Name = "Calibri";
objTextRng.Font.Size = 20;
When I tried to run this code it will give me output for only second textrange which is "second text".
What do I need to do if I want to display both the text in same slide.
I also tried to use different textrange
, textframe
but I am not able to do the same.