This topic shows how to use the SplitPptx plugin to split a PPTX document into several PPTX documents. You select the slides in the constructor, and Save writes one document per part. The part number is added to the output file name: slide.pptx becomes slide_1.pptx, slide_2.pptx, and so on.
Prerequisites
Refer to the Developer Guide to learn how to set up your environment and run the code examples in this section.
The following example puts slides 1, 2, and 3 into documents of their own. Each part is numbered after the source slide it holds: slide_1.pptx, slide_2.pptx, and slide_3.pptx.
usingSystem;usingGroupDocs.Merger.LowCode;// Load license keysvarpublicKey=Environment.GetEnvironmentVariable("GD_PUBLIC_KEY");varprivateKey=Environment.GetEnvironmentVariable("GD_PRIVATE_KEY");// Apply the licenseLicense.Set(publicKey,privateKey);// Select slides 1, 2, and 3varsplitter=newSplitPptx("presentation.pptx",new[]{1,2,3});// Save one document per partsplitter.Save("output/slide.pptx");
ImportsSystemImportsGroupDocs.Merger.LowCodeModuleProgramSubMain()' Load license keys
DimpublicKey=Environment.GetEnvironmentVariable("GD_PUBLIC_KEY")DimprivateKey=Environment.GetEnvironmentVariable("GD_PRIVATE_KEY")' Apply the license
License.Set(publicKey,privateKey)' Select slides 1, 2, and 3
DimsplitterAsNewSplitPptx("presentation.pptx",{1,2,3})' Save one document per part
splitter.Save("output/slide.pptx")EndSubEndModule
openSystemopenGroupDocs.Merger.LowCode[<EntryPoint>]letmain_=// Load license keys
letpublicKey=Environment.GetEnvironmentVariable("GD_PUBLIC_KEY")letprivateKey=Environment.GetEnvironmentVariable("GD_PRIVATE_KEY")// Apply the license
License.Set(publicKey,privateKey)// Select slides 1, 2, and 3
letsplitter=SplitPptx("presentation.pptx",[|1;2;3|])// Save one document per part
splitter.Save("output/slide.pptx")0
In SplitMode.Interval, the slides you list mark where each new part starts. The following example cuts a 13-slide presentation before slide 8: deck_0.pptx holds slides 1 to 7 and deck_1.pptx holds slides 8 to 13. Interval parts are numbered from 0.
usingSystem;usingGroupDocs.Merger.Domain.Options;usingGroupDocs.Merger.LowCode;// Load license keysvarpublicKey=Environment.GetEnvironmentVariable("GD_PUBLIC_KEY");varprivateKey=Environment.GetEnvironmentVariable("GD_PRIVATE_KEY");// Apply the licenseLicense.Set(publicKey,privateKey);// Start a new part at slide 8varsplitter=newSplitPptx("presentation.pptx",new[]{8},SplitMode.Interval);// Save one document per partsplitter.Save("output/deck.pptx");
ImportsSystemImportsGroupDocs.Merger.Domain.OptionsImportsGroupDocs.Merger.LowCodeModuleProgramSubMain()' Load license keys
DimpublicKey=Environment.GetEnvironmentVariable("GD_PUBLIC_KEY")DimprivateKey=Environment.GetEnvironmentVariable("GD_PRIVATE_KEY")' Apply the license
License.Set(publicKey,privateKey)' Start a new part at slide 8
DimsplitterAsNewSplitPptx("presentation.pptx",{8},SplitMode.Interval)' Save one document per part
splitter.Save("output/deck.pptx")EndSubEndModule
openSystemopenGroupDocs.Merger.Domain.OptionsopenGroupDocs.Merger.LowCode[<EntryPoint>]letmain_=// Load license keys
letpublicKey=Environment.GetEnvironmentVariable("GD_PUBLIC_KEY")letprivateKey=Environment.GetEnvironmentVariable("GD_PRIVATE_KEY")// Apply the license
License.Set(publicKey,privateKey)// Start a new part at slide 8
letsplitter=SplitPptx("presentation.pptx",[|8|],SplitMode.Interval)// Save one document per part
splitter.Save("output/deck.pptx")0
Pass the first and the last slide of a range to put every slide of the range into a document of its own. The following example splits out slides 2 to 4.
usingSystem;usingGroupDocs.Merger.LowCode;// Load license keysvarpublicKey=Environment.GetEnvironmentVariable("GD_PUBLIC_KEY");varprivateKey=Environment.GetEnvironmentVariable("GD_PRIVATE_KEY");// Apply the licenseLicense.Set(publicKey,privateKey);// Select slides 2 to 4varsplitter=newSplitPptx("presentation.pptx",2,4);// Save one document per partsplitter.Save("output/slide.pptx");
ImportsSystemImportsGroupDocs.Merger.LowCodeModuleProgramSubMain()' Load license keys
DimpublicKey=Environment.GetEnvironmentVariable("GD_PUBLIC_KEY")DimprivateKey=Environment.GetEnvironmentVariable("GD_PRIVATE_KEY")' Apply the license
License.Set(publicKey,privateKey)' Select slides 2 to 4
DimsplitterAsNewSplitPptx("presentation.pptx",2,4)' Save one document per part
splitter.Save("output/slide.pptx")EndSubEndModule
openSystemopenGroupDocs.Merger.LowCode[<EntryPoint>]letmain_=// Load license keys
letpublicKey=Environment.GetEnvironmentVariable("GD_PUBLIC_KEY")letprivateKey=Environment.GetEnvironmentVariable("GD_PRIVATE_KEY")// Apply the license
License.Set(publicKey,privateKey)// Select slides 2 to 4
letsplitter=SplitPptx("presentation.pptx",2,4)// Save one document per part
splitter.Save("output/slide.pptx")0
Add a RangeMode to narrow the range to its odd or even slides. The following example splits out the even slides from 1 to 6: slides 2, 4, and 6.
usingSystem;usingGroupDocs.Merger.Domain.Options;usingGroupDocs.Merger.LowCode;// Load license keysvarpublicKey=Environment.GetEnvironmentVariable("GD_PUBLIC_KEY");varprivateKey=Environment.GetEnvironmentVariable("GD_PRIVATE_KEY");// Apply the licenseLicense.Set(publicKey,privateKey);// Select the even slides from 1 to 6varsplitter=newSplitPptx("presentation.pptx",1,6,RangeMode.EvenPages);// Save one document per partsplitter.Save("output/even-slide.pptx");
ImportsSystemImportsGroupDocs.Merger.Domain.OptionsImportsGroupDocs.Merger.LowCodeModuleProgramSubMain()' Load license keys
DimpublicKey=Environment.GetEnvironmentVariable("GD_PUBLIC_KEY")DimprivateKey=Environment.GetEnvironmentVariable("GD_PRIVATE_KEY")' Apply the license
License.Set(publicKey,privateKey)' Select the even slides from 1 to 6
DimsplitterAsNewSplitPptx("presentation.pptx",1,6,RangeMode.EvenPages)' Save one document per part
splitter.Save("output/even-slide.pptx")EndSubEndModule
openSystemopenGroupDocs.Merger.Domain.OptionsopenGroupDocs.Merger.LowCode[<EntryPoint>]letmain_=// Load license keys
letpublicKey=Environment.GetEnvironmentVariable("GD_PUBLIC_KEY")letprivateKey=Environment.GetEnvironmentVariable("GD_PRIVATE_KEY")// Apply the license
License.Set(publicKey,privateKey)// Select the even slides from 1 to 6
letsplitter=SplitPptx("presentation.pptx",1,6,RangeMode.EvenPages)// Save one document per part
splitter.Save("output/even-slide.pptx")0