ByteScout Spreadsheet SDK – C# – Select Active Worksheet

  • Home
  • /
  • Articles
  • /
  • ByteScout Spreadsheet SDK – C# – Select Active Worksheet

ByteScout Spreadsheet SDK – C# – Select Active Worksheet

Program.cs

using System;
using System.Collections.Generic;
using System.Text;
using Bytescout.Spreadsheet;
using Bytescout.Spreadsheet.Constants;
using System.Diagnostics;
using System.IO;


namespace HelloWorld
{
    class Program
    {
        static void Main(string[] args)
        {
            // Create new Spreadsheet
            Spreadsheet document = new Spreadsheet();

            // Add new worksheets
            Worksheet worksheet1 = document.Workbook.Worksheets.Add("Worksheet1");
            Worksheet worksheet2 = document.Workbook.Worksheets.Add("Worksheet2");
            Worksheet worksheet3 = document.Workbook.Worksheets.Add("Worksheet3");

            // Activate worksheet2
            worksheet2.Active = true;

            // delete output file if exists already
            if (File.Exists("Output.xls")){
                File.Delete("Output.xls");
            }

            // Save document
            document.SaveAs("Output.xls");

            // Close Spreadsheet
            document.Close();

            // open generated XLS document in default program
            Process.Start("Output.xls");
        }
    }
}


  Click here to get your Free Trial version of the SDK

Tutorials:

prev
next