Ejemplo n.º 1
0
        public override string Create <T>(string path, List <T> data)
        {
            var list = new List <DataTable>();

            if (typeof(T) == typeof(System.Data.DataTable))
            {
                foreach (var item in data)
                {
                    var obj = (object)item;
                    var db  = (System.Data.DataTable)obj;
                    db.TableName = "DBTable";
                    list.Add(db);
                }
            }
            else
            {
                var table = data.ToTable();
                table.TableName = "DBTable";
                list.Add(table);
            }
            string ext          = Path.GetExtension(path);
            string filename     = Guid.NewGuid().ToString("N") + ext;
            string fileSavePath = Path.GetDirectoryName(path) + "\\" + filename;

            File.Copy(path, fileSavePath);
            SmlToHtmlConverterHelper.CreateNewExcel(fileSavePath, list);
            return(filename);
        }
Ejemplo n.º 2
0
        public override string ToHTML(string path, string company, bool dataOnly, bool isallsheet)
        {
            string htmlPath = SmlToHtmlConverterHelper.ConvertToHtml(path, this.FilePath, dataOnly, isallsheet);
            //创建文件目录+ "\\" + company + "\\UserFile\\"
            string name     = System.IO.Path.GetFileNameWithoutExtension(path);
            var    savePath = Path.Combine(this.FilePath, name + "\\");

            if (!Directory.Exists(savePath))
            {
                Directory.CreateDirectory(savePath);
            }
            return(htmlPath);
        }