Пример #1
0
        public void ColumnNames()
        {
            string filename         = TestData.DataPath + "\\ImportWithUpdate.xls";
            SpreadsheetGearExcel db = new SpreadsheetGearExcel(filename);

            string[] cols = db.ColumnNames("Duplicates");
            foreach (var s in cols)
            {
                Console.WriteLine(s);
            }

            Assert.AreEqual(34, cols.Length);
        }
Пример #2
0
        private void RefreshColumnNames()
        {
            this.comboBoxDateColumn.Items.Clear();
            this.comboBoxFilter.Items.Clear();
            this.checkedListBoxSites.Items.Clear();
            this.comboBoxValueColumn.Items.Clear();

            string[] columnNames = { };

            labelError.Text = "";
            try
            {
                if (this.radioButtonHeaderRow.Checked)
                {
                    columnNames = db.ColumnNames(SheetName);
                }
                else
                {
                    columnNames = db.ColumnReferenceNames(SheetName);
                }
            }
            catch (DuplicateNameException e)
            {
                columnNames     = new string[] {};
                labelError.Text = "Error: " + e.Message;
            }

            this.comboBoxDateColumn.Items.AddRange(columnNames);
            this.comboBoxFilter.Items.AddRange(columnNames);
            this.comboBoxValueColumn.Items.AddRange(columnNames);



            if (columnNames.Length > 0)
            {
                comboBoxDateColumn.SelectedIndex = 0;
                //comboBoxValueColumn.SelectedIndex = 0;
                buttonOK.Enabled = true;
            }
            else
            {
                buttonOK.Enabled = false;
            }
        }