Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
315
ArgumentOutOfRangeException throws when deleting sheet.
posted

Load and delete sheet from dbenfachALL.xlsx(https://www.devexpress.com/Support/Center/Question/Details/Q571743),
System.ArgumentOutOfRangeException throws.

===================================================================================================
using System;
using System.IO;
using Infragistics.Documents.Excel;

namespace ConApp
{
    class Program
    {
        static void Main(string[] args)
        {
            Stream stream = File.Open("dbenfachALL.xlsx", FileMode.OpenOrCreate);
            Workbook wb = Workbook.Load(stream);
            if (wb == null)
            {
                return;
            }

            var count = wb.Worksheets.Count;
            for (int i = count - 1; i > 0; i--)
            {
                wb.Worksheets.RemoveAt(i);
            }
        }
    }
}

Parents
No Data
Reply Children
No Data