Click here to Skip to main content
13,400,497 members (37,009 online)
Click here to Skip to main content
Articles » Languages » C# » General » Downloads

Stats

135.3K views
5K downloads
53 bookmarked
Posted 27 Nov 2007

TblProc: OpenOffice Calc and Excel

, 29 Jan 2009
OpenOffice Calc and Excel
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Test
{
    public partial class Form1 : Form
    {
        private List<DataClass> data = new List<DataClass>();
        private bool? useExcel = null;

        public Form1()
        {
            data.Add(new DataClass(0, "Bill", "you-know-yourselves", "IT-gangster ;-)", true));
            data.Add(new DataClass(1, "Alexander", "Pushkin", "Famous poet", false));
            data.Add(new DataClass(2, "Sid", "Vicious", "punk", false));
            data.Add(new DataClass(3, "Jello", "Biafra", "punk too", true));
            data.Add(new DataClass(4, "George W.", "Bush", "ex-US president", false));
            InitializeComponent();
            dataClassBindingSource.DataSource = data;
        }

        private void exportBtn_Click(object sender, EventArgs e)
        {
            try
            {
                Export exp = new Export(grid, "General export", useExcel);
                exp.Create();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Exception caught: " + ex.Message);
            }
        }

        private void createTest_Click(object sender, EventArgs e)
        {
            TestCreator tc = new TestCreator(useExcel);
            tc.Create();
        }

        private void SetTableProcessor(bool? excel)
        {
            useAutomaticToolStripMenuItem.Checked = (excel == null);
            useExcelToolStripMenuItem.Checked = (excel==true);
            useOpenOfficeorgToolStripMenuItem.Checked = (excel == false);
            useExcel = excel;
        }

        private void useExcelToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SetTableProcessor(true);
        }

        private void useOpenOfficeorgToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SetTableProcessor(false);
        }

        private void useAutomaticToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SetTableProcessor(null);
        }

    }
}

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 Common Development and Distribution License (CDDL)

Share

About the Author

Aleksandr Sazonov
Software Developer (Senior)
Russian Federation Russian Federation
No Biography provided

You may also be interested in...

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.180218.2 | Last Updated 29 Jan 2009
Article Copyright 2007 by Aleksandr Sazonov
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid