1
Answer

Convert Excel to XML

Hello all ,
 
code for convert Excel to XML. Please share the code
 
for example if we upload excel file and click convert button it will be convert to XML file .
 
               
 
private void button2_Click(object sender, EventArgs e)
{
         OpenFileDialog();openKeywordsFileDialog.InitialDirectory =          Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
         openKeywordsFileDialog.Multiselect = false;
         openKeywordsFileDialog.ValidateNames = true;
         openKeywordsFileDialog.DereferenceLinks = false; // Will return .lnk in shortcuts.
         openKeywordsFileDialog.Filter = "Excel |*.xlsx";
         openKeywordsFileDialog.FileOk += new          System.ComponentModel.CancelEventHandler(OpenKeywordsFileDialog_FileOk);
         var dialogResult = openKeywordsFileDialog.ShowDialog();
      
}
public void OpenKeywordsFileDialog_FileOk(object sender, System.ComponentModel. CancelEventArgs e)
{
         OpenFileDialog fileDialog = sender as OpenFileDialog;
         string selectedFile = fileDialog.FileName;
         Properties.Settings.Default.Save();
         textBox1.Text = selectedFile;
         if (string.IsNullOrEmpty(selectedFile) || selectedFile.Contains(".lnk"))
         {
               MessageBox.Show("Please select a valid Excel File");
               e.Cancel = true;
         }
         return;
}
private void ConvertExcel_XML(object sender, EventArgs e)
{
 ////// ???? code 
}
 
Thank you, 
Answers (1)
Next Recommended Forum