Example #1
0
        private void btnConvertToXml_Click(object sender, EventArgs e)
        {
            if (File.Exists(txtFile.Text) == false)
            {
                return;
            }

            XmlDocument xmlRawFile = null;

            try
            {
                Cursor = Cursors.WaitCursor;

                if (cboExcelWorksheet.SelectedIndex > -1)
                {
                    RawFileConverter.ExcelWorksheetName = cboExcelWorksheet.SelectedItem.ToString();
                }

                RawFileConverter.AccessDatabaseQuery      = txtAccessQuery.Text.Trim();
                RawFileConverter.PerformValidationCleanup = chkCleanupXml.Checked;

                xmlRawFile = RawFileConverter.ConvertFileToRawXml(txtFile.Text);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error converting file! " + ex.Message);
                return;
            }
            finally
            {
                Cursor = Cursors.Default;
            }

            m_sXmlFilePath = FileUtilities.GetUniqueTempFileName(".xml"); // add the xml extension so the browser can read it
            xmlRawFile.Save(m_sXmlFilePath);

            ApplyOverrideElements(m_sXmlFilePath, txtRootElement.Text, txtRowElement.Text);
            xmlXmlOutputGridView.DataFilePath = m_sXmlFilePath;

            tabOutput.SelectTab(tabXmlOutput);
            SetBehavior();
        }
Example #2
0
 private void btnGetWorksheets_Click(object sender, EventArgs e)
 {
     cboExcelWorksheet.Items.Clear();
     cboExcelWorksheet.Items.AddRange(RawFileConverter.GetExcelWorksheets(txtFile.Text.Trim()));
     cboExcelWorksheet.DroppedDown = true;
 }