إنشاء عرض تقديمي جديد

إنشاء عرض تقديمي

فيما يلي مثالان من التعليمات البرمجية توضحان كيفية استخدام VSTO و Aspose.Slides لـ Java لتحقيق نفس الهدف. المثال الأول هو VSTO؛ المثال الثاني يستخدم Aspose.Slides.

مثال VSTO

مخرجات VSTO

todo:image_alt_text

//Note: PowerPoint is a namespace which has been defined above like this
//using PowerPoint = Microsoft.Office.Interop.PowerPoint;
//Create a presentation
PowerPoint.Presentation pres = Globals.ThisAddIn.Application
.Presentations.Add(Microsoft.Office.Core.MsoTriState.msoFalse);
//Get the title slide layout
PowerPoint.CustomLayout layout = pres.SlideMaster.
CustomLayouts[PowerPoint.PpSlideLayout.ppLayoutTitle];
//Add a title slide.
PowerPoint.Slide slide = pres.Slides.AddSlide(1, layout);
//Set the title text
slide.Shapes.Title.TextFrame.TextRange.Text = "Slide Title Heading";
//Set the sub title text
slide.Shapes[2].TextFrame.TextRange.Text = "Slide Title Sub-Heading";
//Write the output to disk
pres.SaveAs("c:\\outVSTO.ppt",
PowerPoint.PpSaveAsFileType.ppSaveAsPresentation,
Microsoft.Office.Core.MsoTriState.msoFalse);

مثال Aspose.Slides لـ Java

المخرجات من Aspose.Slides

todo:image_alt_text

//Create a presentation
Presentation pres = new Presentation();
//Add the title slide
ISlide slide = pres.getSlides().addEmptySlide(pres.getLayoutSlides().get_Item(0));
//Set the title text
((IAutoShape)slide.getShapes().get_Item(0)).getTextFrame().setText("Slide Title Heading");
//Set the sub title text
((IAutoShape)slide.getShapes().get_Item(1)).getTextFrame().setText("Slide Title Sub-Heading");
//Write output to disk
pres.save("c:\\data\\outAsposeSlides.pptx",SaveFormat.Pptx);