1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using Excel = Microsoft.Office.Interop.Excel;
  10.  
  11. namespace WindowsFormsApplication1
  12. {
  13. public partial class Form1 : Form
  14. {
  15. public Form1()
  16. {
  17. InitializeComponent();
  18. }
  19.  
  20. private void Form1_Load(object sender, EventArgs e)
  21. {
  22. Excel.Application meme = new Excel.ApplicationClass(); ///you've to do something to this line
  23.  
  24. Excel.Range koko = meme.get_Range("Numbers",Type.Missing);
  25.  
  26. koko.Sort(koko.Columns[1, Type.Missing], Excel.XlSortOrder.xlAscending,
  27. koko.Columns[2, Type.Missing], Type.Missing,
  28. Excel.XlSortOrder.xlAscending, Type.Missing,
  29. Excel.XlSortOrder.xlAscending, Excel.XlYesNoGuess.xlNo,
  30. Type.Missing, Type.Missing, Excel.XlSortOrientation.xlSortColumns,
  31. Excel.XlSortMethod.xlPinYin, Excel.XlSortDataOption.xlSortNormal,
  32. Excel.XlSortDataOption.xlSortNormal,
  33. Excel.XlSortDataOption.xlSortNormal);
  34.  
  35.  
  36. }
  37. }
  38. }
  39.