コード例 #1
0
        static void Main(string[] args)
        {
            ///////////////////////////////////////////////// Write my data in Excel File
            OpenFileDialog openFileDialog;

            var myData = new List <TestData>   //My data for test
            {
                new TestData("a1", "b1", "c1"),
                new TestData("a2", "b2", "c2"),
                new TestData("a3", "b3", "c3"),
                new TestData("a4", "b4", "c4"),
                new TestData("a5", "b5", "c5"),
                new TestData("a6", "b6", "c6")
            };

            try
            {
                var wk = new OfficeFramework.Create.Worker();                               //general class for work
                var ex = new TestTable();
                wk.Export(ex.ExcelTableLines(myData), ex.ExcelTableHeader(), "MyTestTemp"); //here i generate DataTeble, labels and send in public void Export(DataTable dataTable, System.Collections.Hashtable hashtable, String templateName) and send my template file name "MyTestTemp"
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }