xls2dbfAPI example

We provide API which you can use from your own application to convert your data from one format to another.

You have to prepare an array with parameters and pass it to the StartConversion function. The list of parameters.

int StartConversion(string[] parameters);

returns 1 if there were not problems and conversion has started;
returns 0 if something is wrong with parameters. Additional info you can get in conversionDidFail.

void CancelConversion();

It allows you to break the conversion. API closes all opened files and stops.

delegate void ConversionDidFail(int code);

The function is called if there was some problem with input parameters:

  • 10 - Input or output files are not defined
  • 20 - Internal exception in the conversion cycle
  • 30 - Cannot open a source file
  • 40 - Cannot overwrite an output file
  • 50 - Cannot open an output file
  • 60 - Cannot save an output file

delegate void ConversionProgress(int percent);

This function provides information about the convertion progress. You can also cancel the process here by calling CancelConversion();

delegate void ConversionComplete(string[] outputFiles);

This function is called after conversion and returns a list of output files.

        private void button_Click(object sender, EventArgs e)
            List<string> args = new List<string>();

            //args.Add("-one more parameter");

            xls2dbfAPI dll = new xls2dbfAPI();

            dll.conversionDidFail += new xls2dbfAPI.ConversionDidFail(
                delegate(int code)
                    MessageBox.Show("Return code " + code.ToString());

            dll.conversionProgress += new xls2dbfAPI.ConversionProgress(
                delegate(int percent)
                    progressBar1.Value = percent;
                    //if (condition)
                    //    dll.CancelConversion();

            dll.conversionComplete += new xls2dbfAPI.ConversionComplete(
                delegate(string[] outputFiles)
                    foreach (String s in outputFiles)