예제 #1
0
        public Hashtable ExportExcels(DataTable dt, List <Column> columns, string displayFileName)
        {
            try
            {
                FileClear();
                string xslt_filename = CreateXsltTempFile(columns);
                if (xslt_filename.Equals(string.Empty))
                {
                    return(null);
                }
                string newExcelFile = TransformXMLDocmentToExcel(dt, xslt_filename);
                if (newExcelFile.Equals(string.Empty))
                {
                    return(null);
                }

                string newExcelZipFile = newExcelFile + ".zip";
                ZipClass.ZipFile(newExcelFile, newExcelZipFile, displayFileName);


                Hashtable ht = new Hashtable();
                ht.Add("newExcelZipFile", newExcelFile);
                ht.Add("BaseUrl", BaseUrl);
                ht.Add("displayFileName", displayFileName);


                OutputFile(newExcelZipFile, displayFileName + ".zip");
                DeleteFile(newExcelFile);
                DeleteFile(xslt_filename);
                DeleteFile(newExcelZipFile);
                return(ht);
            }
            catch { return(null); }
        }
예제 #2
0
        public void ExportExcel(DataTable dt, string displayFileName)
        {
            try
            {
                string newExcelFile = TransformXMLDocmentToExcel(dt, this.TemplateFile);
                if (newExcelFile.Equals(string.Empty))
                {
                    return;
                }

                string newExcelZipFile = newExcelFile + ".zip";
                ZipClass.ZipFile(newExcelFile, newExcelZipFile, displayFileName);

                OutputFile(newExcelZipFile, displayFileName + ".zip");
                DeleteFile(newExcelFile);
                DeleteFile(newExcelZipFile);
            }
            catch
            {
            }
        }