admin管理员组

文章数量:1346198

So i will be creating set of 10 slides for each scenarios, and say i may have around 30 scenarios. So i was trying to make this concurrent where the generation of data and creating slide should be made concurrently.

 futures.add(executorService.submit(() -> {
                                try {
                                    List<PowerPointSlideSpec> pptSlides = generalPptGenerator.processSiteResults();
    
                                    XMLSlideShow threadTemplate = prepareTemplate(TemplateType.BASIC); 
                                    SlideResolver slideResolver = new SlideResolver(threadTemplate);
                                    pptSlides.forEach(slideResolver::resolve); 
    
                                    return threadTemplate; // Return thread-local XMLSlideShow
                                } catch (Exception e) {
                                    log.error("Error processing site result " + siteResult.getName(), e);
                                    throw new RuntimeException("Error processing site result: " + siteResult.getName(), e);
                                }

After combining the future lists of XMLSlideShow from executorService and forming a single list of XMLSlideShow called threadReports i tried the below code to combine the slides.

XMLSlideShow finalReport = prepareTemplate(TemplateType.BASIC);
        for (XMLSlideShow threadReport : threadReports) {
            for (XSLFSlide slide : threadReport.getSlides()) {
                if (finalReport != null) {
                    finalReport.createSlide().importContent(slide);
                }
            }
        }

But then this is not a efficient way to combine the slides together. i have to again copy each slide to a new final XMLSlideShow which takes even more time than expected. Any better way of doing this, does apache-poi allow combining multiple slides created separately?

本文标签: