Link Search Menu Expand Document

Select Active Worksheet - C#

Spreadsheet SDK sample in C# demonstrating ‘Select Active Worksheet’

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")){

            // Save document

            // Close Spreadsheet

            // open generated XLS document in default program

Download Source Code (.zip)

Return to the previous page Explore Spreadsheet SDK

Copyright © 2016 - 2023 ByteScout