Getting Started

In order to use Sunflower Excel .Net in your application, you must first add a reference to it:
   1. In Solution Explorer (VisualStudio.Net) , expand the project node you want to add a reference to.
   2. Right-click the References node for the project and select Add Reference from the shortcut menu:

   Add reference

   3. Locate the component using the Browse button.
   4. The component you referenced appears in the SelectedComponents pane of the dialog box:

   Add component

   5. Click OK when you have added reference to the component.

CopyC# example
 1using System;
 2
 3namespace Project1
 4{
 5    public class Class1
 6    {
 7        static void Main()
 8        {
 9            Console.Write("Converting XLS to HTML: ");
10            DuoDimension.Sunflower.Excel conv = new DuoDimension.Sunflower.Excel("");
11            if (conv.IsExcelInstalled)
12            {
13                int ret = conv.XlsToHtml(@"d:\test.xls", @"d:\test.html");
14                switch (ret)
15                {
16                    case 0: Console.Write("...Ok."); break;
17                    case 1: Console.Write("...error: can't open file."); break;
18                    case 2: Console.Write("...error: can't save the destination file."); break;
19                }
20            }
21        }
22    }
23}

 

CopyVB.NET example
 1Module Module1
 2    Sub Main()
 3        Console.Write("Converting XLS to HTML: ")
 4        Dim conv As New DuoDimension.Sunflower.Excel("")
 5
 6        If conv.IsExcelInstalled = True Then
 7            Dim ret = conv.XlsToHtml("d:\test.xls", "d:\test.html")
 8            Select Case ret
 9                Case 0
10                    Console.Write("...Ok.")
11                Case 1
12                    Console.Write("...error: can't open file.")
13                Case 2
14                    Console.Write("...error: can't save the destination file.")
15            End Select
16        End If
17    End Sub
18End Module