Move Worksheet in WPF

It is not an easy task for WPF developers moving worksheet to another location in a workbook, as calculations or charts that are based on worksheet data might become inaccurate if you move the worksheet in WPF application. Here presents a solution that saves you from these worries. Apply Spire.Xls for WPF in your application,  and you easily can move worksheet in your WPF application.

Spire.XLS for WPF is a professional Excel component which enables developers/programmers to fast generate, read, write and modify Excel document in WPF applications. Spire.XLS for .NET embed a method - Spire.Xls.WorkShee.MoveWorksheet(int destIndex) in its class design used to move a worksheet to another location in the spreadsheet. The method takes the target worksheet index as a parameter and lead no inaccuracy on these calculations or charts.

Now Feel free to download Spire.XLS for WPF and use  the code samples below to move worksheet in WPF application.

using Spire.Xls;
using System.Windows;

namespace WpfApplication1
    public partial class MainWindow : Window
        public MainWindow()
        private void button2_Click(object sender, RoutedEventArgs e)
            //open Excel
            Workbook mywbk = new Workbook();

            // Locate the Worksheet
            Worksheet mysht = mywbk.Worksheets[0];

            //Move Worksheet

            //Save and Launch

Imports Spire.Xls
Imports System.Windows

Namespace WpfApplication1
	Public Partial Class MainWindow
		Inherits Window
		Public Sub New()
		End Sub
		Private Sub button2_Click(sender As Object, e As RoutedEventArgs)
			'open Excel
			Dim mywbk As New Workbook()

			' Locate the Worksheet
			Dim mysht As Worksheet = mywbk.Worksheets(0)

			'Move Worksheet

			'Save and Launch

		End Sub
	End Class
End Namespace