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:
c# asp.net dicom document viewer: ASP.NET Dicom Document Viewer Control: view, annotate dicom imaging files online in ASP.NET
c# asp.net webforms document viewer: ASP.NET WebForms application document viewer control: view, annotate, redact, convert files online in ASP.NET
c# asp.net powerpoint document viewer: ASP.NET PowerPoint Document Viewer Control: view pptx files online in C# using ASP.NET
c# asp.net tiff document viewer: ASP.NET Tiff Document Viewer: view, annotate Tiff files in HTML using C# Control
asp.net convert pdf using c#: ASP.NET Convert PDF Control: Convert, export PDF to Word, HTML, Tiff files in C# ASP.NET
asp.net azure pdf editor using c#: ASP.NET Azure PDF Editor Control: view, edit, annotate, redact PDF files online
asp.net doc document viewer: ASP.NET Office Word Document Viewer: view MS Office Word files online using C# in ASP.NET web applications


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());