Click here to Skip to main content
15,885,138 members
Articles / Programming Languages / C#

Component for Fast Pass/Retrieve Data from Excel

Rate me:
Please Sign up or sign in to vote.
5.00/5 (10 votes)
13 Mar 2009CPOL3 min read 52.5K   2.2K   77  
ExcelCommunicator allows to pass and retrieve data to/from Excel as datasource/calculation-engine
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ExcelCommunicator;
using System.IO;

namespace WindowsClient
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            DateTime initdate = DateTime.Now;
            Configuration config=Configuration.Read(this.textboxPath.Text);
            Parser parser = new Parser();
            parser.GetExcelOutputs(config,new object[]{this.textboxInput.Text});
            this.dataGridView1.DataSource=parser.GetTable(0);
            DateTime endate = DateTime.Now;
            TimeSpan span = endate - initdate;
            double totalseconds = span.TotalSeconds;
            pictureBox1.Image=Image.FromStream(new MemoryStream(parser.GetChart(1)));
            this.label3.Text = totalseconds.ToString();
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Comments and Discussions