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

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


Support Customizing Page Order of Excel Document in C# Project




Overview



RasterEdge C#.NET Excel document page reordering control SDK (XDoc.Excel) is a thread-safe .NET library that can be used to adjust the Excel document pages order. vb.net read pdf file, asp.net mvc create pdf from html, c# best tiff compression, display pdf in iframe mvc, convert word byte array to pdf byte array c#, c# tiff encoder. This Excel document page reorganizing control condenses quick Excel page sorting functions into a compact library, which is compatible with .NET-compliant programming language C#.


Related .net document control helps:
asp.net mvc text file viewer: ASP.NET Text file viewer in MVC, WebForms: Open, view, annotate, convert txt files in C# ASP.NET
asp.net edit pdf image control: ASP.NET PDF Image Edit Control: online insert, edit PDF images in C#
asp.net annotate pdf control: ASP.NET Annotate PDF Control: annotate, comment, markup PDF document online using ASP.NET C#
asp.net excel view: ASP.NET Excel Viewer in C# Control (MVC & WebForms): view Office Excel document in web browser.
asp.net image viewer zoom: ASP.NET Image Viewer Control(MVC & WebForms): view, annotate, redact, convert image files in html, JQuery
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 document viewer control: EdgeDoc:ASP.NET Document Viewer C# Control: Open, view, annotate, redact, convert documents online in C#, VB.NET, AS...


Using this C#.NET Excel document page reorganizing library control, developers can swap or adjust the order of all or several Excel document pages, or just change the position of certain one Excel page in an extremely easy and quick way using C# code. vb.net convert jpg to pdf, add header and footer in pdf using itextsharp c#, convert pdf to jpg using vb.net, vb.net code to convert excel to pdf, convert pdf to png using itextsharp c#, how to redact a pdf in c#, vb.net change pdf metadata.


Besides C#.NET Excel document page sorting function, RasterEdge has also offered other .NET Excel page processing functions, like Excel documents merging, Excel page rotating, Excel image extracting, Excel page inserting, Excel page deleting and Excel document splitting. asp.net display image from memorystream, asp.net display pdf, asp.net edit pdf, asp.net mvc open excel file, asp.net remove image from pdf file, display pdf in iframe mvc, asp.net pdf preview.




C# DLLs: Move Excel Page Position



Add necessary 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.Excel.dll


  RasterEdge.XImage.Raster.Core.dll


  RasterEdge.XImage.Raster.dll


Using namespaces:


  using RasterEdge.Imaging.Basic;


  using RasterEdge.XDoc.Excel;




Swap Two Excel Pages Position Using C#



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



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

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

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





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


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



//  get XLSXDocument object from a source file
String inputFilePath = Program.RootPath + "\\" + "1.xlsx";
XLSXDocument doc = new XLSXDocument(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 XLSXDocument
String outputFilePath = Program.RootPath + "\\" + "Output.xlsx";
doc.Save(outputFilePath);