|
ppt:insert-slide(
|
|
$map as map:map
|
|
$from-pres as xs:string+
|
|
$from-idx as xs:integer+
|
|
$insert-idx as xs:integer
|
) as map:map |
|
 |
Summary:
This function returns updated map for the presentation, with slides inserted from
presentations specified in parameters.
The keys for the map are the names for the files within a presentation .pptx package. The value for the key is either
A) a URI for a presentation part in MarkLogic, or B) the actual XML element for the respective presentation package part.
Note: the lengths of the sequences of $from-pres and $from-idx must be equal, otherwise an Error is thrown.
Note: a slide may be inserted into the presentation contained within $map at any slide index that is
within the count of slides contained within the presentation +1. Trying to insert a slide into an index that is not allowed results in Error.
|
Parameters:
$map:
The map for a .pptx presentation.
|
$from-pres:
The directory in MarkLogic for a presentation from which slides will be inserted into the presentation within $map.
|
$from-idx:
The index of the slide within the $from-pres that is to be inserted into $map.
|
$insert-idx:
The insertion point for the presentation within $map, where the slide inserted from $from-pres will be inserted at.
|
|
Example:
In the following example, we have 2 presentations we've saved: demo_one.pptx and demo_two.pptx. These have both been unzipped and their respectve parts saved to MarkLogic using the Office OpenXML Extract pipeline. Opening the presentations (.pptx) in PowerPoint, the slides appear as follows:
demo_one.pptx | | demo_two.pptx |
 |
|
 |
| | |
 |
|
|
demo_one.pptx has 2 slides, and demo_two.pptx has 1. We can insert slide 1 of demo_two.pptx to position 2 of presentation demo_one.pptx from the extracted parts to create demo_three.pptx as follows:
xquery version "1.0-ml";
import module namespace ppt= "http://marklogic.com/openxml/powerpoint" at "/MarkLogic/openxml/presentation-ml-support.xqy";
let $target-pres:="/demo_one_pptx_parts/" (:target presentation:)
let $source-pres:="/demo_two_pptx_parts/" (:source presentation:)
let $source-idx := 1 (:index of slide in source to copy to target :)
let $start-idx := 2 (:insertion index of target presentation :)
let $pptx-map := ppt:package-map($target-pres)
let $new-map := ppt:insert-slide($pptx-map,$source-pres, $source-idx, $start-idx)
let $pptx-pkg := ppt:package-map-zip($new-map)
return xdmp:save("C:\demo_three.pptx",$pptx-pkg)
The resulting presentation, when opened in PowerPoint will be:
|
Example:
We can insert slides from multiple source presentations into a single destination presentation as well.
xquery version "1.0-ml";
import module namespace ppt= "http://marklogic.com/openxml/powerpoint" at "/MarkLogic/openxml/presentation-ml-support.xqy";
let $targ-pres:="/one_pptx_parts/" (:target presentation:)
let $source-pres-one:= "/two_pptx_parts/" (:source presentation:)
let $source-pres-two:= "/three_pptx_parts/" (:another source presentation:)
let $s-idx-1 := 1 (: index of slide in source-pres-one to copy to target :)
let $s-idx-2 := 15 (: index of slide in source-pres-two to copy to target :)
let $start-idx := 2 (: insertion index starting point of target presentation :)
let $pptx-map := ppt:package-map($targ-pres)
return ppt:insert-slide($pptx-map, ($source-pres-one,$source-pres-two), ($s-idx-1,$s-idx-2), $start-idx)
=>
Returns a map containing the presentation contained within /one_pptx_parts/,
updated to include slide 1 from /two_pptx_parts/ and slide 15 from /three_pptx_parts/ as slides 2 and 3 respectively.
Assuming the presentation within /one_pptx_parts/ started with 3 slides, it now has 5 total,
and its original slides 2 and 3 have been shifted to 4 and 5 respectively.
For each slide mapped within the map, images will be retained and references throughout the package will be updated.
Slides will use the master and layout of the presentation within the map. Slides inserted will retain the target presentation look and feel.
Note: While this function works great for a certain class of Slides, and retains images, animations, and much more for a Slide when inserting from the original source into the target presentation, this function currently does not support Smart Art, Diagrams, Embeddings (.xlsx), or the ability to insert a Slide into a target presentation while maintaining the slideMaster and slideLayout from the original source presentation. Also, while Notes are available in the target presentation, notes will not be retained for slides inserted from the source presentations.
|
|
© Copyright 2002-2010 Mark Logic Corporation. All rights reserved.
|
|