生成Excel文件,然后将数据输入到单元格中

时间:2019-04-23 00:24:13

标签: c# excel

我想用C#生成一个Excel文件供用户将数据放入例如[1,2] [3,4] [5,6]列中,然后从用户保存这些数据,关闭excel文件并使用输入的数据进行一些计算。

我能够生成Excel文件,但我不知道如何处理其余部分

using System;  
using System.Collections.Generic;  
using System.ComponentModel;  
using System.Data;  
using System.Diagnostics;  
using System.Drawing;  
using System.Linq;  
using System.Text;  
using System.Threading.Tasks;  
using System.Windows.Forms;  
using System.Windows.Automation;  
using SuperSocket.SocketBase;

namespace WindowsFormsApplication1  
{  
public partial class Form1 : System.Windows.Forms.Form  
{  
    //Global Variables  
    public static class Globals  
    {  
        public static bool EditorWorking = false;  
        public static bool WEPrompts = true;  

        public static int EditorCheck = 1;  
        public static String FuncError = "Form_Load";  
        public static String NeedToUpload = "No";  
    }  

    //private System.Windows.Forms.NotifyIcon notifyIcon1;  
    //private System.Windows.Forms.ContextMenu contextMenu1;  
    //private System.Windows.Forms.MenuItem menuItem1;  
    //private System.ComponentModel.IContainer components;  

    public Form1()  
    {  
        //InitializeComponent();  
        StartSuperWebSocket();  
        //CreateTrayIcon();  
    }  

    private void StartSuperWebSocket()  
    {  
        var appServer = new WebSocketServer();  

        //Setup the appServer  
        if (!appServer.Setup(2012)) //Setup with listening port  
        {  
            Console.WriteLine("Failed to setup!");  
            Console.ReadKey();  
            return;  
        }  

        appServer.NewMessageReceived += new SessionHandler<WebSocketSession, string>(appServer_NewMessageReceived);  

        Console.WriteLine();  

        //Try to start the appServer  
        if (!appServer.Start())  
        {  
            Console.WriteLine("Failed to start!");  
            Console.ReadKey();  
            return;  
        }  
    }  
}  
}

0 个答案:

没有答案