Link Search Menu Expand Document

Export To HTML - C#

Spreadsheet SDK sample in C# demonstrating ‘Export To HTML’

Program.cs
using System;
using System.Collections.Generic;
using System.Text;
using Bytescout.Spreadsheet;
using System.IO;
using System.Diagnostics;

namespace ExportToHTML
{
    class Program
    {
        static void Main(string[] args)
        {
            // Open Spreadsheet
            Spreadsheet document = new Spreadsheet();
            document.LoadFromFile("SimpleReport.xls");

            // Get Worksheet
            Worksheet worksheet = document.Workbook.Worksheets[0];


            // delete output file if exists already
            if (File.Exists("SimpleReport.htm")){
                File.Delete("SimpleReport.htm");
            }

            // Export to HTML
            worksheet.SaveAsHTML("SimpleReport.htm");

            // Close Spreadsheet
            document.Close();

            // open generated HTML
            Process.Start("SimpleReport.htm");
        }
    }
}

Download Source Code (.zip)

Return to the previous page Explore Spreadsheet SDK