当前位置: 首页>>代码示例>>C#>>正文


C# FlexCelPdfExport.Export方法代码示例

本文整理汇总了C#中FlexCelPdfExport.Export方法的典型用法代码示例。如果您正苦于以下问题:C# FlexCelPdfExport.Export方法的具体用法?C# FlexCelPdfExport.Export怎么用?C# FlexCelPdfExport.Export使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FlexCelPdfExport的用法示例。


在下文中一共展示了FlexCelPdfExport.Export方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Download_CM

        //
        // GET: /Tally_Sheet_Export/Details/T0001
        public ActionResult Download_CM(int id)
        {
            //temp file name
            string copy_file_name = DateTime.Now.Ticks + ".xlsx";
            //template file name
            string Orginal_file_path = Path.Combine(System.Web.HttpContext.Current.Server.MapPath("~/Report_Templates"), "Cargo_Manifest_Export.xlsx");
            //temp file path
            string copy_file_path = Path.Combine(System.Web.HttpContext.Current.Server.MapPath("~/App_Data"), copy_file_name);

            XlsFile cargo = new XlsFile(Orginal_file_path);

            cargo.ActiveSheet = 1;

            cargo.SetCellValue(1, 2, "Cargo Manifest - " + id);

            var cargo_details = from t in db.E_Tally_Sheet
                                join sd in db.Ship_Departure on t.ship_departure_id equals sd.ship_departure_id
                                join s in db.Ships on sd.shipp_id equals s.ship_id
                                join e in db.Employees on t.employee_id equals e.employee_id
                                where t.tally_sheet_id == id
                                select new { t.tally_sheet_id, s.ship_name, sd.starting_date, sd.ship_departure_code, e.first_name, e.middle_name, e.last_name };

            foreach (var item in cargo_details)
            {
                cargo.SetCellValue(2, 2, item.ship_name);
                cargo.SetCellValue(3, 2, item.starting_date);
                cargo.SetCellValue(4, 2, item.ship_departure_code);
                cargo.SetCellValue(5, 2, item.first_name + " " + item.middle_name + " " + item.last_name);
            }
            var cargo_goods_details = db.Cargo_Manifest_Export(id).OrderBy(e => e.way_bill_id);

            var iRowCnt = 8;

            foreach (var item in cargo_goods_details)
            {

                cargo.SetCellValue(iRowCnt, 1, item.way_bill_code);
                cargo.SetCellValue(iRowCnt, 2, item.exporter);
                cargo.SetCellValue(iRowCnt, 3, item.goods);
                cargo.SetCellValue(iRowCnt, 4, item.quantity);
                cargo.SetCellValue(iRowCnt, 5, item.unit_of_measure);
                cargo.SetCellValue(iRowCnt, 6, item.is_damaged);
                iRowCnt = iRowCnt + 1;
            }

            FlexCelPdfExport flexpdf = new FlexCelPdfExport();
            flexpdf.Workbook = cargo;
            flexpdf.AllowOverwritingFiles = true;
            flexpdf.Export(copy_file_path.Replace(".xlsx",".pdf"));

            var save_name = "Cargo_Manifest_" + id+".pdf";

            this.DownLoadFile(save_name, copy_file_name);
            this.DeleteFile(copy_file_name);

            return RedirectToAction("Index");
        }
开发者ID:BTEEMRIYAS,项目名称:TestProject,代码行数:59,代码来源:Tally_Sheet_ExportController.cs

示例2: GeneratePDF

        public void GeneratePDF(XlsFile xls, string Rep_name)
        {
            //create temp directory
            string merge_directory = DateTime.Now.Ticks.ToString();
            string merge_directory_path = Path.Combine(System.Web.HttpContext.Current.Server.MapPath("~/MergePDF"), merge_directory);
            System.IO.Directory.CreateDirectory(merge_directory_path);

            //ExportPdf(xls, filepath, Rep_name);
            //XlsFile xls = new XlsFile(path);

            xls.ActiveSheet = 1;

            string copy_file_name_import = DateTime.Now.Ticks + ".pdf";

            //temp file path
            string copy_file_path_import = Path.Combine(System.Web.HttpContext.Current.Server.MapPath("~/MergePDF/" + merge_directory), copy_file_name_import);

            FlexCelPdfExport flexpdf = new FlexCelPdfExport();
            flexpdf.Workbook = xls;
            flexpdf.AllowOverwritingFiles = true;
            flexpdf.Export(copy_file_path_import);

            if (!Rep_name.ToLower().Contains("report_1_") && !Rep_name.ToLower().Contains("report_3_"))
            {
                xls.ActiveSheet = 2;

                string copy_file_name_export = DateTime.Now.Ticks + ".pdf";

                //temp file path
                string copy_file_path_export = Path.Combine(System.Web.HttpContext.Current.Server.MapPath("~/MergePDF/" + merge_directory), copy_file_name_export);

                flexpdf = new FlexCelPdfExport();
                flexpdf.Workbook = xls;
                flexpdf.AllowOverwritingFiles = true;
                flexpdf.Export(copy_file_path_export);

            }
            string copy_file_name_target = DateTime.Now.Ticks + ".pdf";

            string copy_file_path_target = Path.Combine(System.Web.HttpContext.Current.Server.MapPath("~/Images"), copy_file_name_target);

            CreateMergedPDF(copy_file_path_target, merge_directory_path);
            Response.AppendHeader("Content-Disposition", "attachment; filename=" + Rep_name + ".pdf");
            Response.TransmitFile(copy_file_path_target);
            Response.End();
        }
开发者ID:BTEEMRIYAS,项目名称:TestProject,代码行数:46,代码来源:ReportController.cs


注:本文中的FlexCelPdfExport.Export方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。