C#: Online Guide
How To: powerpoint SDK
Page: Move PowerPoint Page Position
Page: Move PowerPoint Page Position
  |  
Home ›› XDoc.PowerPoint ›› C# PowerPoint: Move PowerPoint Page Position

C# PowerPoint - Sort PowerPoint Pages Order in C#.NET


Support Customizing Page Order of PowerPoint Document in C# Project




Overview



RasterEdge C#.NET PowerPoint document page reordering control SDK (XDoc.PowerPoint) is a thread-safe .NET library that can be used to adjust the PowerPoint document pages order. This PowerPoint document page reorganizing control condenses quick PowerPoint page sorting functions into a compact library, which is compatible with .NET-compliant programming language C#.


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 document viewer: ASP.NET PDF Document Viewer in C#: open, display, view, annotate, redact Adobe PDF files online in ASP.NET MVC & WebForm...
asp.net annotate pdf: ASP.NET Annotate PDF Control: annotate, comment, markup PDF document online using ASP.NET C#


Using this C#.NET PowerPoint document page reorganizing library control, developers can swap or adjust the order of all or several PowerPoint document pages, or just change the position of certain one PowerPoint page in an extremely easy and quick way using C# code.


Besides C#.NET PowerPoint document page sorting function, RasterEdge has also offered other .NET PowerPoint page processing functions, like PowerPoint documents merging, PowerPoint page rotating, PowerPoint image extracting, PowerPoint page inserting, PowerPoint page deleting and PowerPoint document splitting.




C# DLLs: Move PowerPoint Page Position



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;




Swap Two PowerPoint Pages Position Using C#



You may choose two pages of PowerPoint file and exchange their position.




String filepath = @"";
String outPutFilePath = @"";
PPTXDocument doc = new PPTXDocument(filepath);

// Swap page 0 and page 1.
doc.SwapTwoPages(0, 1);

// Save PowerPoint document.
doc.Save(outPutFilePath);





Sort Multiple PowerPoint Pages with a Certain Order in C#.NET



Use C# sample code below to sort several pages of PowerPoint file to your desired order.




//  get PPTXDocument object from a source file
String inputFilePath = Program.RootPath + "\\" + "1.pptx";
PPTXDocument doc = new PPTXDocument(inputFilePath);

//  show page count of the document
int pageCount = doc.GetPageCount();
Console.WriteLine("Page Count: " + pageCount);

//  define the new order for all pages
//  1. the length of the array MUST BE equal to pageCount
//  2. each page index SHOULD be in the array and only once
//  otherwise, the method would throw exception
int[] pageOrders = new int[] { 1, 3, 0, 5, 4, 6, 2 };
doc.SortPage(pageOrders);

//  save the PPTXDocument
String outputFilePath = Program.RootPath + "\\" + "Output.pptx";
doc.Save(outputFilePath);