Aspose.Words.Examples.CSharp.Loading_Saving.Worker.Execute C# (CSharp) Method

Execute() private method

Performs the Word to HTML conversion.
private Execute ( string srcFileName, string tocTemplate, string dstDir ) : void
srcFileName string The MS Word file to convert.
tocTemplate string An MS Word file that is used as a template to build /// A table of contents. This file needs to have a mail merge region called "TOC" defined /// And one mail merge field called "TocEntry".
dstDir string The output directory where to write HTML files. Must exist.
return void
        internal void Execute(string srcFileName, string tocTemplate, string dstDir)
        {
            mDoc = new Document(srcFileName);
            mTocTemplate = tocTemplate;
            mDstDir = dstDir;

            ArrayList topicStartParas = SelectTopicStarts();
            InsertSectionBreaks(topicStartParas);
            ArrayList topics = SaveHtmlTopics();
            SaveTableOfContents(topics);
        }

Usage Example

        public static void Run()
        {
            // You need to have a valid license for Aspose.Words.
            // The best way is to embed the license as a resource into the project
            // And specify only file name without path in the following call.
            // Aspose.Words.License license = new Aspose.Words.License();
            // License.SetLicense(@"Aspose.Words.lic");


            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

            string srcFileName = dataDir + "SOI 2007-2012-DeeM with footnote added.doc";
            string tocTemplate = dataDir + "TocTemplate.doc";

            string outDir = Path.Combine(dataDir, "_out");

            Directory.CreateDirectory(outDir);

            // This class does the job.
            Worker w = new Worker();

            w.Execute(srcFileName, tocTemplate, outDir);


            Console.WriteLine("\nDocument split into HTML pages successfully.\nFile saved at " + outDir);
        }
All Usage Examples Of Aspose.Words.Examples.CSharp.Loading_Saving.Worker::Execute