Example #1
0
        private void cmdImport_tabTILSOFTFile_Click(object sender, EventArgs e)
        {
            string uniqueFileName = Path.GetTempPath() + @"\" + System.Guid.NewGuid().ToString().Replace("-", "") + ".xlsx";
            string pointer        = string.Empty;

            System.IO.FileInfo           epFInfo   = new System.IO.FileInfo(uniqueFileName);
            OfficeOpenXml.ExcelPackage   ePackagae = new OfficeOpenXml.ExcelPackage(epFInfo);
            OfficeOpenXml.ExcelWorksheet pWS       = ePackagae.Workbook.Worksheets.Add("Result");
            List <DTO.FilePointer>       result    = new List <DTO.FilePointer>();

            foreach (FileInfo fInfo in (new DirectoryInfo(FrameworkSetting.Setting.AbsoluteReportTmpFolder)).GetFiles())
            {
                pointer = string.Empty;
                DTO.FilePointer fPointer = new DTO.FilePointer()
                {
                    PhysicalFileName = fInfo.Name
                };
                try
                {
                    fPointer.FilePointerUD = fwFactory.CreateFilePointer(FrameworkSetting.Setting.AbsoluteReportTmpFolder, fInfo.Name, string.Empty);
                    fwFactory.CreateImageCache(fPointer.FilePointerUD, 120, 120, false);
                    result.Add(fPointer);
                }
                catch (Exception ex)
                {
                }
            }
            pWS.Cells["A1"].LoadFromCollection(result, true);
            ePackagae.Save();
            System.Diagnostics.Process.Start(uniqueFileName);
        }