Free Support Forum - aspose.com

Presentation.save() opens in powerpoint with incorrect view settings

When using Presentation.save() to stream a presentation from memory to device (via the browser) and then opening the file in powerpoint, the slide thumbnail pane and preview pane are minimized as shown in the attached image.
format-of-exported-presentation-broken.jpg (108.0 KB)

The cause is unknown and I’d like to know if there is a property in the Presentation model that can be used to set the width/height of the slide thumbnail pane and slide preview pane so the file opens normally in powerpoint.
normal file.jpg (208.1 KB)

Here’s the basic code I’m using:

public ResponseEntity<?> merge(@RequestParam(required = false) Float width,
                               @RequestParam(required = false) Float height,
                               @RequestParam("pageIds[]") List<Long> pageIds) throws Exception {

    Presentation targetPres = new Presentation();
   
    if (width == null)
        width = com.contiq.common.aspose.Defs.DEFAULT_PAGE_WIDTH;  // 960
    if (height == null)
        height = com.contiq.common.aspose.Defs.DEFAULT_PAGE_HEIGHT;  // 540

    targetPres.getSlideSize().setSize(width, height, 0);

    ISlideCollection targetSlides = targetPres.getSlides();

    targetSlides.removeAt(0);
   // Now create a byte stream array from the target presentation and stream back to the client
    ByteArrayOutputStream bos = new ByteArrayOutputStream();

    targetPres.save(bos, SaveFormat.Pptx);

    byte[] buffer = bos.toByteArray();

    String responseContentType = "application/vnd.openxmlformats-officedocument.presentationml.presentation";

    ByteArrayInputStream bis = new ByteArrayInputStream(buffer, 0, buffer.length);

    return ResponseEntity
            .ok()
            .contentLength(buffer.length)
            .contentType(MediaType.parseMediaType(responseContentType))
            .body(new InputStreamResource(bis));

}

Here is the pptx file created on device from the response. Opening it will reveal those oddly sized panes which confuses the user into thinking there is only one slide in the presentation.
Copy of Editor Test Deck.pptx (1).ppt.zip (152.1 KB)

@rahul.contiq,

I have observed your comments. Can you please share complete working sample project along with jdk version and Aspose.Slides version you are using in your end and environment details with us so that we may further investigate to help you out.

Hi @Adnan.Ahmad,

The JDK Version used is Java SE 8 and Aspose.Slides version used is 18.3. In our project Aspose slides is one of the many components, sharing the entire project is not feasible. Is it possible to identify the source for this issue with the above mentioned information.

@rahul.contiq,

I suggest you to please first try using Aspose.Slides for Java 18.7 on your end. This default view issue appeared in some previous versions and has been fixed in latest versions. Can you please try using latest version on your end. Secondly, while saving the presentation, please try using complete statement in SaveFormat. i.e. com.aspose.slides.SaveFormat.Pptx.