PowerPoint Integration

API to get bit map image from HTML5-based controls - Chart, Drawing, and Gantt

var image = controlPanel.getImageBytes();

JavaScript API to request a pptx report

workflow.startJob('AbSystemAdministration-generatePaginatedReport-generatePpt', slides, config); slides: Array of slide with either images or texts slide: {title:title, notes:notes, images:[image,…], texts:[text,…], type:’flash’} title: optional a string value. notes: optional a string value. images: optional array of bitmap. If there are multiple images, the slide will display them side by side. type: optional if images are Flash-based bit maps, type is required to be ’flash’. texts: optional array of string. config: {template:template, fileName: fileName } template: optional if not setting up, the core will use default pptx template located under WEB-INF\config\context\reports\ppt a primary key value from the template_id field of doc_templates table in database fileName: optional if not setting up, the core will generate pptx with timestamp as file name. pptx file name and the file must be located under WEB-INF\config\context\reports\ppt

Java API to assemble a pptx report

/** * Uses PresentationBuilder, PresentationInfo and SlideInfo to build a PowerPoint presentation with text and image slides. * @param slides List<Map<String, String>> client-side passed slides. * @param config Map<String, String> client-side passed presentation config. */ public void generatePresentation(final List<Map<String, String>> slides, final Map<String, String> config) { //slides is allowed to be null if there is no client-side data final List<SlideInfo> slideInfos = PresentationUtilities.parse(slides); { // add a text slide final SlideInfo textSlide = new SlideInfo(); textSlide.setTitle("The #1 Solution for Real Estate, Infrastructure, and Facilities Management in the World"); textSlide.setNotes("Solutions That Mean Savings"); textSlide.getTexts().add("Archibus reduces complexity through native business intelligence."); textSlide.getTexts().add("Archibus turns BIM, GIS and Mobile into powerhouses."); slideInfos.add(textSlide); } // add more slides with images from database addMoreSlides(slideInfos); //config is allowed to be null if there is no client-side data final PresentationInfo presentationInfo = PresentationUtilities.parse(config); { // two ways to set up presentation template, either template stored in database doc_templates table or template located in file system // set a template from doc_templates table by its primary key value // presentationInfo.setTemplatePresentation(DocTemplateUtilities.getDocTemplate("ppt_default_template")); // set a template from WEB-INF\config\context\reports\ppt by its file name // presentationInfo.setTemplatePresentation(PresentationUtilities.getTemplateFromFileSystem("template.pptx")); } final JobStatus status = new JobStatus(); //use PresentationBuilder to build pptx final PresentationBuilder builder = new PresentationBuilder(); builder.build(presentationInfo, slideInfos, status); //get pptx file and and url assertNotNull(status.getResult().name); assertNotNull(status.getResult().url); } /** * Adds more slides with images from table activity_log.doc. * @param slideInfos List<SlideInfo>. */ private void addMoreSlides(final List<SlideInfo> slideInfos) { // define dataSource final DataSource dataSource = DataSourceFactory.createDataSource().addTable("activity_log") .addField("action_title").addField("activity_log_id").addField("description").addField("comments").addField("doc") .addRestriction(Restrictions.isNotNull("activity_log", "doc")); dataSource.setContext(); final Context context = ContextStore.get(); final List<DataRecord> records = dataSource.getRecords(); for (final DataRecord record : records) { final String docFieldValue = record.getString("activity_log.doc").toLowerCase(); // add image record into presentation slides if (docFieldValue.endsWith(".png") || docFieldValue.endsWith(".jpg") || docFieldValue.endsWith(".gif")) { final SlideInfo slide = new SlideInfo() // slide's title slide.setTitle(record.getString("activity_log.action_title")); // slide's notes slide.setNotes(StringUtil.notNull(record.getString("activity_log.description")) + '\n' + StringUtil.notNull(record.getString("activity_log.comments"))); // slide's content: image final Map<String, String> keys = new HashMap<String, String>(); keys.put("activity_log_id", StringUtil.notNull(record.getValue("activity_log.activity_log_id"))); // use ReportUtility.getImage() to get image from database slide.getImages().add( ReportUtility.getImage("activity_log", "doc", keys, context)); slideInfos.add(slide); } } }