Beispiel #1
0
        void createXLSFile()
        {
            using (this.con)
            {
                if (con.State == ConnectionState.Closed)
                {
                    con.Open();
                }
                string         sqlAccounts = @"select distinct ACCNO, ACCNAME from View_Kite_LoadReport_ACCNO";
                SqlDataAdapter adp         = new SqlDataAdapter(sqlAccounts, con);
                DataSet        dst         = new DataSet();
                adp.Fill(dst, "ACCOUNTS");

                string sqlAll = "select * from View_Kite_LoadReport_ACCNO order by ACCNO,ACCNAME,CORTEXDATE,CRDPRODUCT,PROGRAMID,ACCTYPE";
                adp = new SqlDataAdapter(sqlAll, con);
                adp.Fill(dst, "ALL");

                LoadsXLSCreator loads = new LoadsXLSCreator(dst.Tables["ACCOUNTS"]);
                loads.CreateFlatSheet(dst.Tables["ALL"]);
                LoadsXLSCreator.CellFieldProperty ACCNO = new LoadsXLSCreator.CellFieldProperty("ACCNO");// "ACCNO", "ACCNAME"\
                //"CORTEXDATE", "CRDPRODUCT", "PROGRAMID", "ACCTYPE", "DESCRIPTION", "AMTBILL"
                loads.HeaderFields((new LoadsXLSCreator.CellFieldProperty("ACCNO")), (new LoadsXLSCreator.CellFieldProperty("ACCNAME")))
                .DetailFields((new LoadsXLSCreator.CellFieldProperty("CORTEXDATE", CarlosAg.ExcelXmlWriter.DataType.String, "{0:MM/dd/yyyy}")),
                              (new LoadsXLSCreator.CellFieldProperty("CRDPRODUCT")), (new LoadsXLSCreator.CellFieldProperty("PROGRAMID")),
                              (new LoadsXLSCreator.CellFieldProperty("ACCTYPE")), (new LoadsXLSCreator.CellFieldProperty("DESCRIPTION")),
                              (new LoadsXLSCreator.CellFieldProperty("AMTBILL", CarlosAg.ExcelXmlWriter.DataType.Number)))
                .Create();
            }
        }
Beispiel #2
0
        void createXLSFile()
        {
            using (this.con)
            {
                if(con.State==ConnectionState.Closed) con.Open();
                string sqlAccounts = @"select distinct ACCNO, ACCNAME from View_Kite_LoadReport_ACCNO";
                SqlDataAdapter adp = new SqlDataAdapter(sqlAccounts, con);
                DataSet dst = new DataSet();
                adp.Fill(dst, "ACCOUNTS");

                string sqlAll = "select * from View_Kite_LoadReport_ACCNO order by ACCNO,ACCNAME,CORTEXDATE,CRDPRODUCT,PROGRAMID,ACCTYPE";
                adp = new SqlDataAdapter(sqlAll, con);
                adp.Fill(dst, "ALL");

                LoadsXLSCreator loads = new LoadsXLSCreator(dst.Tables["ACCOUNTS"]);
                loads.CreateFlatSheet(dst.Tables["ALL"]);
                LoadsXLSCreator.CellFieldProperty ACCNO = new LoadsXLSCreator.CellFieldProperty("ACCNO");// "ACCNO", "ACCNAME"\
                //"CORTEXDATE", "CRDPRODUCT", "PROGRAMID", "ACCTYPE", "DESCRIPTION", "AMTBILL"
                loads.HeaderFields((new LoadsXLSCreator.CellFieldProperty("ACCNO")), (new LoadsXLSCreator.CellFieldProperty("ACCNAME")))
                    .DetailFields((new LoadsXLSCreator.CellFieldProperty("CORTEXDATE",CarlosAg.ExcelXmlWriter.DataType.String,"{0:MM/dd/yyyy}")),
                    (new LoadsXLSCreator.CellFieldProperty("CRDPRODUCT")), (new LoadsXLSCreator.CellFieldProperty("PROGRAMID")),
                    (new LoadsXLSCreator.CellFieldProperty("ACCTYPE")),(new LoadsXLSCreator.CellFieldProperty("DESCRIPTION")),
                    (new LoadsXLSCreator.CellFieldProperty("AMTBILL",CarlosAg.ExcelXmlWriter.DataType.Number)))
                    .Create();
            }
        }