The CancelConversion method stops the conversion process and optionally deletes the generated files.

Syntax

void CancelConversion(bool deleteGeneratedFiles = true)
CODE

Parameters

deleteGeneratedFiles - a boolean value that indicates whether the generated files must be deleted. The default value of this parameter is true.

Description

This method stops the presentation conversion process that was started using the GenerateFlash, GenerateSolidPresentation, GenerateCompoundPresentation, and GenerateStandaloneSlides methods of the PresentationConverter Class. It is usually called in the conversion event handler.

Return value

none.

Example

C# Sample

The following sample creates a simple window with Convert and Cancel buttons.

When the user clicks the Convert button, the "c:\test.pptx" file is converted to the "c:\test.html" file. During the conversion process, the index of a slide that is currently processed is displayed on the form.

When a user clicks the Cancel button, the conversion process is aborted using the CancelConversion method.

using System;
using System.Windows.Forms;

using iSpring;

namespace GUITest
{
    public partial class Form1 : Form
    {
        private PresentationConverter m_converter;

        public Form1()
        {
            InitializeComponent();

            m_converter = new PresentationConverter();

            // initialize event handlers
            m_converter.OnIdle += new _IPresentationConverterEvents_OnIdleEventHandler(converter_OnIdle);
            m_converter.OnSlideProgressChanged += new _IPresentationConverterEvents_OnSlideProgressChangedEventHandler(converter_OnSlideProgressChanged);

        }

        void converter_OnSlideProgressChanged(int slideIndex, int totalSlides)
        {
            // display currently processed slide
            currentSlideLabel.Text = "Current slide: " + (slideIndex + 1) + " / " + totalSlides;
            Application.DoEvents();
        }

        void converter_OnIdle()
        {
            // handle window events during conversion
            Application.DoEvents();
        }

        private void btnConvert_Click(object sender, EventArgs e)
        {
            btnConvert.Enabled = false;
            btnCancel.Enabled = false;
            try
            {
                m_converter.OpenPresentation("c:\\test.pptx");
                m_converter.GenerateHtml5Presentation("c:\\test.html", PresentationType.PT_COMPOUND, "", null);
            }
            catch(Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            btnCancel.Enabled = false;
            btnConvert.Enabled = true;
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            btnCancel.Enabled = false;
            m_converter.CancelConversion(true);
            btnConvert.Enabled = true;
        }
    }
}
C#