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)