Package com.aspose.slides

Examples of com.aspose.slides.Presentation


public class AsposeCreatePresentation
{
  public static void main(String[] args)
  {
    //Instantiate a Presentation object that represents a PPT file
    Presentation pres = new Presentation();
    //Writing the presentation as a PPT file
    pres.save("data/NewPPT_Aspose.ppt", SaveFormat.Ppt);

    //Printing the status
        System.out.println("Aspose Slides added successfully!");
  }
View Full Code Here


public class AsposeOpenandSave
{
  public static void main(String[] args) throws Exception
  {
    //Instantiate a PresentationEx object that represents a PPTX file
    Presentation pres = new Presentation("data/presentation.ppt");
   
      //Add the title slide
      ISlide slide = pres.getSlides().addEmptySlide(pres.getLayoutSlides().get_Item(0));
   
    //Save the presentation
    pres.save("data/EditedPPT_Aspose.ppt", SaveFormat.Ppt);
   
    System.out.println("Presentation Edited and Saved.");
  }
View Full Code Here

public class AsposeSlideTitle
{
  public static void main(String[] args)
  {
    //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("data/Aspose_SlideTitle.pptx",SaveFormat.Pptx);
  }
View Full Code Here

  public static void main(String[] args)
  {
    // ======================================
    // Adding Slide Comments
    // ======================================
    Presentation pres = new Presentation();
   
    // Adding Empty slide
    pres.getSlides().addEmptySlide(pres.getLayoutSlides().get_Item(0));
   
    // Adding Author
    ICommentAuthor author = pres.getCommentAuthors().addAuthor("Aspose", "AS");
   
    // Position of comments
    java.awt.geom.Point2D.Float point = new java.awt.geom.Point2D.Float(0.2f, 0.2f);
    java.util.Date date = new java.util.Date();
   
    // Adding slide comment for an author on slide 1
    author.getComments().addComment("Hello Aspose, this is slide comment",
        pres.getSlides().get_Item(0), point, date);
   
    // Adding slide comment for an author on slide 1
    author.getComments().addComment("Hello Aspose, this is second slide comment",
        pres.getSlides().get_Item(1), point, date);
   
    // Accessing ISlide 1
    ISlide slide = pres.getSlides().get_Item(0);
   
    // if null is passed as an argument then it will bring comments from all
    // authors on selected slide
    IComment[] Comments = slide.getSlideComments(author);
   
    // Accessing the comment at index 0 for slide 1
    String str = Comments[0].getText();
   
    pres.save("data/AsposeComments.pptx", SaveFormat.Pptx);
   
    if (Comments.length > 0)
    {
      // Select comments collection of Author at index 0
      ICommentCollection commentCollection = Comments[0].getAuthor().getComments();
   
      String Comment = commentCollection.get_Item(0).getText();
    }
   
    // ======================================
    // Accessing Slide Comments
    // ======================================
   
    // Presentation pres = new Presentation("data/AsposeComments.pptx");
    for (ICommentAuthor author1 : pres.getCommentAuthors())
    {
      for (IComment comment : author1.getComments())
      {
        System.out.println("ISlide :"
          + comment.getSlide().getSlideNumber()
View Full Code Here

public class AsposeTransitions
{
  public static void main(String[] args)
  {
    //Instantiate Presentation class that represents a presentation file
    Presentation pres = new Presentation("data/presentation.pptx");

    //Apply circle type transition on slide 1
    pres.getSlides().get_Item(0).getSlideShowTransition().setType(TransitionType.Circle);

    //Apply comb type transition on slide 2
    pres.getSlides().get_Item(1).getSlideShowTransition().setType( TransitionType.Comb);

    //Apply zoom type transition on slide 3
    pres.getSlides().get_Item(2).getSlideShowTransition().setType(TransitionType.Zoom);

    //Write the presentation to disk
    pres.save("data/AsposeTransition.pptx",SaveFormat.Pptx);
   
    System.out.println("First Transition File is saved.");
   
    //==============================================================
   
    //Instantiate a Presentation object that represents a PPT file
    Presentation presentation = new Presentation("data/presentation.pptx");

    //Apply circle type transition on slide 1
    presentation.getSlides().get_Item(0).getSlideShowTransition().setType(TransitionType.Circle);


    //Set the transition time of 3 seconds
    //Set the transition time of 5 seconds
    presentation.getSlides().get_Item(0).getSlideShowTransition().setAdvanceOnClick( true);
    presentation.getSlides().get_Item(0).getSlideShowTransition().setAdvanceAfterTime (3000);

    //Apply comb type transition on slide 2
    presentation.getSlides().get_Item(1).getSlideShowTransition().setType( TransitionType.Comb);


    //Set the transition time of 5 seconds
    presentation.getSlides().get_Item(1).getSlideShowTransition().setAdvanceOnClick( true);
    presentation.getSlides().get_Item(1).getSlideShowTransition().setAdvanceAfterTime (5000);

    //Apply zoom type transition on slide 3
    presentation.getSlides().get_Item(2).getSlideShowTransition().setType(TransitionType.Zoom);

    //Set the transition time of 7 seconds
    presentation.getSlides().get_Item(2).getSlideShowTransition().setAdvanceOnClick( true);
    presentation.getSlides().get_Item(2).getSlideShowTransition().setAdvanceAfterTime (7000);

    //Write the presentation to disk
    presentation.save("data/AsposeTransition2.pptx",SaveFormat.Pptx);
   
    System.out.println("Second Transition File is saved.");
  }
View Full Code Here

public class AsposeAudioFrame
{
  public static void main(String[] args) throws Exception
  {
    //Instantiate Prsentation class that represents the PPTX
    Presentation pres = new Presentation();
   
    //Get the first slide
    ISlide sld = pres.getSlides().get_Item(0);
   
    //Load the wav sound file to stram
    FileInputStream fstr = new FileInputStream(new File("C:\\logon.wav"));
   
    //Add Audio Frame
    IAudioFrame af = sld.getShapes().addAudioFrameEmbedded(50, 150, 100, 100, fstr);
   
    //Set Play Mode and Volume of the Audio
    af.setPlayMode(AudioPlayModePreset.Auto);
    af.setVolume(AudioVolumeMode.Loud);
   
    //Write the PPTX file to disk
    pres.save("data/AsposeAudio.pptx", SaveFormat.Pptx);
   
    System.out.println("Audio Control Added.");
  }
View Full Code Here

  public static void main(String[] args)
  {
        // 1. Conversion to PDF using default options.

    //Instantiate a Presentation object that represents a PPT file
    Presentation pres = new Presentation("data/presentation.ppt");
   
    //Saving the presentation to PDF document
    pres.save("data/AsposeConvert.pdf", SaveFormat.Pdf);
   
    //Display result of conversion.
    System.out.println("Conversion to PDF performed successfully with default options!");
       
        // 2. Conversion to PDF using custom options.

        //Instantiate the PdfOptions class
        com.aspose.slides.PdfOptions opts = new com.aspose.slides.PdfOptions();

        //Set JPEG Quality
        opts.setJpegQuality((byte)90);

        //Define behavior for meta files
        opts.setSaveMetafilesAsPng(true);

        //Set Text Compression level
        opts.setTextCompression(com.aspose.slides.PdfTextCompression.Flate);

        //Define the PDF standard
        opts.setCompliance(com.aspose.slides.PdfCompliance.Pdf15);

        //Save the presentation to PDF with specified options
        pres.save("data/AsposeConvert2.pdf", SaveFormat.Pdf,opts);

        //Display result of conversion.
        System.out.println("Conversion to PDF performed successfully with custom options!");
  }
View Full Code Here

{
  public static void main(String[] args)
  {
    //=================================================
      //Create empty presentation instance
      Presentation newPptx = new Presentation();

      //Adding the Media Player ActiveX control
      newPptx.getSlides().get_Item(0).getControls().addControl(ControlType.WindowsMediaPlayer, 50, 50, 550, 300);

      //Access the Media Player ActiveX control and set the video path
      newPptx.getSlides().get_Item(0).getControls().get_Item(0).getProperties().set_Item("URL", "C:\\Wildlife.wmv");

      //Save the Presentation
      newPptx.save("data/AsposeMediaPlayer.pptx", SaveFormat.Pptx);   
   
    System.out.println("Media Player Added.");
  }
View Full Code Here

    //==================
    //Adding Smart Art
    //==================
   
    //Instantiate Presentation Class
    Presentation pres = new Presentation();
   
    //Get first slide
    ISlide slide = pres.getSlides().get_Item(0);
   
    //Add Smart Art Shape
    ISmartArt smart = slide.getShapes().addSmartArt(0, 0, 400, 400, SmartArtLayoutType.BasicBlockList);
   
    //Saving presentation
    pres.save("data/AsposeSmartArt.pptx", SaveFormat.Pptx);
         
    //=====================
    //Accessing Smart Art
    //=====================
    //Get first slide
    ISlide slide0 = pres.getSlides().get_Item(0);
   
    //Traverse through every shape inside first slide
    for(IShape shape : slide0.getShapes())
    {
        //Check if shape is of SmartArt type
View Full Code Here

public class AsposeCloneToEnd
{
  public static void main(String[] args)
  {
    //Instantiate Presentation class that represents a PPTX file
    Presentation pres = new Presentation("data/presentation.pptx");
   
    //Clone the desired slide to the end of the collection of slides in the same PPTX
    ISlideCollection slds = pres.getSlides();
    slds.addClone(pres.getSlides().get_Item(0));

//Write the modified pptx to disk
pres.save("data/AsposeClone.pptx", SaveFormat.Pptx);

        //Printing the status
        System.out.println("Slide cloned successfully!");
  }
View Full Code Here

TOP

Related Classes of com.aspose.slides.Presentation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.