//Reading source and Destination Presentations
PresentationEx SourcePres = new PresentationEx("d:\\ppt\\Source.pptx");
PresentationEx DestPres = new PresentationEx("d:\\ppt\\notext.pptx");
//Reading the source text frame
AutoShapeEx aShp_Source = (AutoShapeEx)SourcePres.Slides[0].Shapes[0];
TextFrameEx TxtFrame_Source = aShp_Source.TextFrame;
//Creating a shape in the destination slide as in source slide
int ShpId = DestPres.Slides[0].Shapes.AddAutoShape(ShapeTypeEx.Rectangle, aShp_Source.X, aShp_Source.Y, aShp_Source.Width, aShp_Source.Height);
AutoShapeEx aShp_Dest = (AutoShapeEx)DestPres.Slides[0].Shapes[ShpId];
//Setting Shape Fill type and Line type to as of source shape
aShp_Dest.FillFormat.FillType = aShp_Source.FillFormat.FillType;
aShp_Dest.LineFormat.FillFormat.FillType= aShp_Source.LineFormat.FillFormat.FillType;
//Reading destination shape text frame
TextFrameEx TxtFrame_Dest = aShp_Dest.TextFrame;
//clearing all pargarphs
TxtFrame_Dest.Paragraphs.Clear();
//Iterating through each paragraph of source shape TextFrame
foreach (ParagraphEx Paragraph_Source in TxtFrame_Source.Paragraphs)
{
ParagraphEx newPara = new ParagraphEx();
//Iterating through each portion of particular paragraph
foreach (PortionEx Portion_Source in Paragraph_Source.Portions)
{
// PortionEx oldPort = Paragraph_Source.Portions[0];
PortionEx newPort = new PortionEx(Portion_Source);
//Add new paragraph and new portion
newPara.Portions.Add(newPort);
}
//Setting allighnmet of particular destiantion paragraph
//to as of respective source paragraph
newPara.RawAlignment = Paragraph_Source.RawAlignment;
//Adding paragraph to destination TextFrame
TxtFrame_Dest.Paragraphs.Add(newPara);
}
DestPres.Write("D://ppt//result.pptx");