本文介绍了Bytescout.spreadsheet是一个'命名空间',但用作'类型'错误。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是我的代码。在调试时它显示两个错误:

The following is the code that i have. On debugging it shows two errors:

Bytescout.spreadsheet is a 'namespace'; but is used like a 'type'.



以下是代码:


The following is the code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Bytescout.Spreadsheet.Demo.Csharp.ExportTo2DArray
{
    class Program
    {
        static void Main(string[] args)
        {
            const string inputFile = @"data.xls";

            // Open and load spreadsheet
            Spreadsheet spreadsheet = new Spreadsheet(); //**error in this line
            spreadsheet.LoadFromFile(inputFile);

            // Get the data from the spreadsheet
            string[,] data = spreadsheet.ExportTo2DArray();

            // Close spreadsheet
            spreadsheet.Close();

            // Display data in data table
            for (int i = 0; i < data.GetLength(0); i++)
            {
                for (int j = 0; j < data.GetLength(1); j++)
                {
                    Console.Write(data[i, j] + " ");
                }
                Console.WriteLine();
            }

            // Pause
            Console.ReadLine();
        }
    }
}

推荐答案


这篇关于Bytescout.spreadsheet是一个'命名空间',但用作'类型'错误。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-30 06:07