C#: Online Guide
How To: powerpoint SDK
File: Split PowerPoint Document
File: Split PowerPoint Document
  |  
Home ›› XDoc.PowerPoint ›› C# PowerPoint: Split PowerPoint Document

C# PowerPoint - Split PowerPoint Document in C#.NET


Explain How to Split PowerPoint Document in Visual C#.NET Application




Overview



C# PowerPoint document splitting library control, XDoc.PowerPoint, provides an advanced C# programming way to split PowerPoint document into smaller PowerPoint files in .NET developing applications. Using this C#.NET PowerPoint document splitting library control, C# developers can easily and accurately disassemble multi-page PowerPoint document into two or more separate PowerPoint document files by page(s).


Related .net document control helps:
asp.net powerpoint viewer: ASP.NET PowerPoint Document Viewer Control (MVC & WebForms): view ppt, pptx files online in C# using ASP.NET
asp.net mvc document viewer: ASP.NET MVC Document Viewer: view, annotate, redact files on ASP.NET MVC web projects
asp.net word document viewer: ASP.NET Office Word Document Viewer: view Word doc files online using C# in ASP.NET MVC web applications
asp.net image viewer: ASP.NET Image Viewer Control(MVC & WebForms): view, annotate, redact, convert image files in html, JQuery
asp.net multipage tiff viewer: ASP.NET Tiff Viewer: view, annotate multipage Tiff images in ASP.NET MVC, WebForms using C# Control
asp.net pdf viewer: ASP.NET PDF Viewer Control: view, navigate, zoom Adobe PDF document in C# ASP.NET
asp.net pdf document viewer: ASP.NET PDF Document Viewer in C#: open, display, view, annotate, redact Adobe PDF files online in ASP.NET MVC & WebForm...


RasterEdge Visual C# .NET PowerPoint document splitter control toolkit SDK can not only offer C# developers a professional .NET solution to split PowerPoint document file but also provide them the ability to name outputted PowerPoint document files with a customized name pattern using a few lines of simple Visual C# code.


This C#.NET PowerPoint document splitting library control offers developers an efficient PowerPoint document splitting approach, using which C# developers can split target PowerPoint document file by specifying a page or pages. If needed, developers can also combine generated split PowerPoint document files with other PowerPoint files to form a new PowerPoint file using RasterEdge XDoc.PowerPoint. Besides, in the process of splitting PowerPoint document, developers can also remove certain PowerPoint page from target PowerPoint file using C#.NET PowerPoint page deletion API.


Please note, PowerPoint file will be divided from the previous page of your defined page number which starts from 0. For example, your original PowerPoint file contains 4 pages. If your page number is set as 1, then the two output PowerPoint files will contains the first page and the later three pages respectively.




C# DLLs: Split PowerPoint Document



Add necessary XDoc.PowerPoint DLL libraries into your created C# application as references.


  RasterEdge.Imaging.Basic.dll


  RasterEdge.XDoc.Office.Inner.Common.dll


  RasterEdge.Imaging.Drawing.dll


  RasterEdge.Imaging.Processing.dll


  RasterEdge.XDoc.Office.Inner.Office03.dll


  RasterEdge.Imaging.Font.dll


  RasterEdge.XDoc.PowerPoint.dll


  RasterEdge.XImage.Raster.Core.dll


  RasterEdge.XImage.Raster.dll


Use corresponding namespaces;


  using RasterEdge.Imaging.Basic;


  using RasterEdge.XDoc.PowerPoint;




Split PowerPoint file into two files in C#



This is an C# example of splitting a PowerPoint file into multiple ones by number of pages.




String inputFilePath = Program.RootPath + "\\" + "1.pptx";
String outputFilePath1 = Program.RootPath + "\\" + "Split1.pptx";
String outputFilePath2 = Program.RootPath + "\\" + "Split2.pptx";
String[] outputOps = new  String[] { outputFilePath1, outputFilePath2 };
//  split a PowerPoint file with options
PPTXDocument.SplitDocument(inputFilePath, 2, outputOps);





Split PowerPoint Document into Multiple PowerPoint Files in C#



You can use the following C# demo to split PowerPoint document to four files.




String inputFilePath = Program.RootPath + "\\" + "1.pptx";
String outputFileName = "Output.pptx";
int[] splitIndex = new int[3] { 1, 3, 5 }; // Valid value for each index: 1 to (Page Count - 1).

// Create output PowerPoint file path list
List<String> outputFilePaths = new List<String>();
for (int i = 0; i <= splitIndex.Length; i++)
{
        outputFilePaths.Add(Program.RootPath + "\\" + outputFileName + "_" + i.ToString() + ".pptx");
}

// Split input PowerPoint file to 4 files:
// File 0: page 0.
// File 1: page 1 ~ 2.
// File 2: page 3 ~ 4.
// File 3: page 5 ~ the last page.
PPTXDocument.SplitDocument(inputFilePath, splitIndex, outputFilePaths.ToArray());