Ejemplo n.º 1
0
    protected void BtnPdf_Click(object sender, EventArgs e)
    {
        ExcelFile Xls = new XlsFile();

        CreateFile(Xls);

        FlexCelPdfExport Pdf = new FlexCelPdfExport(Xls);

        using (MemoryStream ms = new MemoryStream())
        {
            Pdf.BeginExport(ms);
            try
            {
                Pdf.ExportAllVisibleSheets(true, "Getting Started");
            }
            finally
            {
                Pdf.EndExport();
            }
            ms.Position = 0;
            Response.Clear();
            Response.AddHeader("Content-Disposition", "attachment; filename=Test.pdf");
            Response.AddHeader("Content-Length", ms.Length.ToString());
            Response.ContentType = "application/pdf"; //octet-stream";
            Response.BinaryWrite(ms.ToArray());
            Response.End();
        }
    }
Ejemplo n.º 2
0
        private void btnExportPDF_Click(object sender, System.EventArgs e)
        {
            string PdfPath = Path.Combine(ResultPath, "FeaturesFlexCel.pdf");

            using (DataSet data = LoadDataSet())
            {
                XlsFile Xls = Export(data);
                Directory.CreateDirectory(ResultPath);

                using (FlexCelPdfExport pdf = new FlexCelPdfExport(Xls, true))
                {
                    using (FileStream pdfStream = new FileStream(PdfPath, FileMode.Create))
                    {
                        pdf.BeginExport(pdfStream);
                        pdf.FontMapping = TFontMapping.ReplaceAllFonts;

                        pdf.Properties.Subject = "A list of FlexCel.NET features";
                        pdf.Properties.Author  = "TMS Software";
                        pdf.Properties.Title   = "List of FlexCel.NET features";
                        pdf.PageLayout         = TPageLayout.Outlines;
                        pdf.ExportAllVisibleSheets(false, "Features");
                        pdf.EndExport();
                    }
                }
            }

            if (MessageBox.Show("Do you want to open the generated file?", "Confirm", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                Process.Start(PdfPath);
            }
        }
        public override Task <bool> Export(Stream stream, DataLogReport dlr)
        {
            return(Task.Factory.StartNew(() => {
                try {
                    // TODO [email protected]: Not necessary
                    var scaleReduction = 60; // TODO DEFINE

                    var file = new XlsFile((showAllData ? 2 : 1) + dlr.graphImages.Count, TExcelFileFormat.v2013, true);
                    file.AllowOverwritingFiles = true;
                    file.PrintScale = scaleReduction;
                    // Note: [email protected]: Per kyle's original writing
                    // SET A UNIFORM CELL WIDTH FOR COVER PAGE ITEMS. DEFAULT COLUMN WIDTH = 3189 AND SETTING IT TO 1.3x RESULTING IN 4317
                    file.SetColWidth(1, 8, 4317); // TODO DEFINE

                    InitializeToFile(file);
                    RenderFile(file, dlr);

                    // Commit file to stream
                    using (var pdf = new FlexCelPdfExport(file, true)) {
                        pdf.GetFontData += (sender, e) => {
                            var ms = new MemoryStream(1024 * 64);
                            using (var fontStream = dlr.localization.GetFontStream()) {
                                var buffer = new byte[1024];
                                var read = -1;
                                while ((read = fontStream.Read(buffer, 0, buffer.Length)) > 0)
                                {
                                    ms.Write(buffer, 0, buffer.Length);
                                }
                            }
                            e.FontData = ms.ToArray();
                            ms.Dispose();
                        };

                        pdf.BeginExport(stream);

                        for (int i = 1; i <= file.SheetCount; i++)
                        {
                            file.ActiveSheet = i;
                            pdf.ExportSheet();
                        }

                        pdf.EndExport();
                    }

                    return true;
                } catch (Exception e) {
                    Log.E(this, "Failed to export datalog report", e);
                    return false;
                }
            }));
        }
 /// <summary>
 /// Hiển thị báo cáo dạng pdf
 /// </summary>
 /// <param name="MaND">Mã người dùng</param>
 /// <param name="iID_MaPhongBan">Mã phòng ban</param>
 /// <returns></returns>
 public ActionResult ViewPDF(string MaND, string iID_MaPhongBan,string iThang)
 {
     HamChung.Language();
     ExcelFile xls = CreateReport(Server.MapPath(sFilePath), MaND, iID_MaPhongBan,iThang);
     using (FlexCelPdfExport pdf = new FlexCelPdfExport())
     {
         pdf.Workbook = xls;
         using (MemoryStream ms = new MemoryStream())
         {
             pdf.BeginExport(ms);
             pdf.ExportAllVisibleSheets(false, "BaoCao");
             pdf.EndExport();
             ms.Position = 0;
             return File(ms.ToArray(), "application/pdf");
         }
     }
 }
Ejemplo n.º 5
0
 internal void ExportToPdf()
 {
     try
     {
         if (AllVisibleSheets)
         {
             try
             {
                 using (FileStream f = new FileStream(FileName, FileMode.Create, FileAccess.Write))
                 {
                     PdfExport.BeginExport(f);
                     PdfExport.PageLayout = TPageLayout.Outlines;
                     PdfExport.ExportAllVisibleSheets(false, System.IO.Path.GetFileNameWithoutExtension(FileName));
                     PdfExport.EndExport();
                 }
             }
             catch
             {
                 try
                 {
                     File.Delete(FileName);
                 }
                 catch
                 {
                     //Not here.
                 }
                 throw;
             }
         }
         else
         {
             PdfExport.PageLayout = TPageLayout.None;
             PdfExport.Export(FileName);
         }
     }
     catch (Exception ex)
     {
         FMainException = ex;
     }
 }
Ejemplo n.º 6
0
    protected void Button3_Click(object sender, EventArgs e)
    {
        ExcelFile xls = CreateReport();

        using (MemoryStream ms = new MemoryStream())
        {
            using (FlexCelPdfExport pdf = new FlexCelPdfExport())
            {
                pdf.Workbook = xls;
                pdf.BeginExport(ms);
                pdf.ExportAllVisibleSheets(false, "FlexCel");
                pdf.EndExport();
                ms.Position = 0;
                Response.Clear();
                Response.AddHeader("Content-Disposition", "attachment; filename=Test.pdf");
                Response.AddHeader("Content-Length", ms.Length.ToString());
                Response.ContentType = "application/pdf"; //octet-stream";
                Response.BinaryWrite(ms.ToArray());
                Response.End();
            }
        }
    }
        /// <summary>
        /// Hiện thị báo cáo theo định dạng PDF
        /// </summary>
        /// <param name="NamLamViec">Năm</param>
        /// <param name="Thang_Quy">Tháng | Quý</param>
        /// <param name="LoaiThang_Quy">1: Quý | 0: Tháng</param>
        /// <param name="LoaiBaoCao">Loại báo cáo in ra</param>
        /// <param name="inmuc">In đến mục loại khoản - mục - tiểu mục</param>
        /// <param name="iID_MaNguonNganSach">Nguồn ngân sách</param>
        /// <param name="iGom">On: Ghép 2 báo cáo trên file | off: Ngược lại</param>
        /// <param name="UserID">Người dùng</param>
        /// <returns></returns>
        public ActionResult ViewPDF(String NamLamViec, String Thang_Quy, String LoaiThang_Quy, String LoaiBaoCao, String inmuc, String iID_MaNguonNganSach, String iGom, String UserID)
        {
            HamChung.Language();
            String DuongDan = "";
            DuongDan = GetPath(LoaiBaoCao, iGom, DuongDan);
            ExcelFile xls = CreateReport(Server.MapPath(DuongDan), NamLamViec, Thang_Quy, LoaiThang_Quy, LoaiBaoCao, inmuc, iID_MaNguonNganSach, iGom,UserID);
            using (FlexCelPdfExport pdf = new FlexCelPdfExport())
            {
                pdf.Workbook = xls;
                using (MemoryStream ms = new MemoryStream())
                {
                    pdf.BeginExport(ms);
                    pdf.ExportAllVisibleSheets(false, "BaoCao");
                    pdf.EndExport();
                    ms.Position = 0;
                    return File(ms.ToArray(), "application/pdf");
                }

            }
            return null;
        }
        public ActionResult ViewPDF(String MaND, String ThangQuy, String LoaiThang_Quy, String iID_MaDonVi, String iID_MaNhomDonVi, String LuyKe, String iID_MaTrangThaiDuyet, String KhoGiay, String BaoHiem,String iLoai)
        {
            HamChung.Language();
            String sFilePath = "";
            if (KhoGiay == "0")
            {
                if (BaoHiem == "0" || BaoHiem == "1" || BaoHiem == "2")
                {
                    sFilePath = "/Report_ExcelFrom/BaoHiem/rptBH_TongQuyetToan1.xls";
                }
                else if (BaoHiem == "3")
                {
                    sFilePath = "/Report_ExcelFrom/BaoHiem/rptBH_TongQuyetToanCN.xls";
                }
                else if (BaoHiem == "4")
                {
                    sFilePath = "/Report_ExcelFrom/BaoHiem/rptBH_TongQuyetToanDV.xls";
                }
                else
                {
                    sFilePath = "/Report_ExcelFrom/BaoHiem/rptBH_TongQuyetToanTH.xls";
                }
            }

            else
            {

                if (BaoHiem == "0" || BaoHiem == "1" || BaoHiem == "2")
                {
                    sFilePath = "/Report_ExcelFrom/BaoHiem/rptBH_TongQuyetToan1A3.xls";
                }
                else if (BaoHiem == "3")
                {
                    sFilePath = "/Report_ExcelFrom/BaoHiem/rptBH_TongQuyetToanCNA3.xls";
                }
                else if (BaoHiem == "4")
                {
                    sFilePath = "/Report_ExcelFrom/BaoHiem/rptBH_TongQuyetToanDVA3.xls";
                }
                else
                {
                    sFilePath = "/Report_ExcelFrom/BaoHiem/rptBH_TongQuyetToanTH.xls";
                }
            }
            ExcelFile xls = CreateReport(Server.MapPath(sFilePath), MaND, ThangQuy, LoaiThang_Quy, iID_MaDonVi, iID_MaNhomDonVi, LuyKe, iID_MaTrangThaiDuyet, KhoGiay, BaoHiem,iLoai);
            using (FlexCelPdfExport pdf = new FlexCelPdfExport())
            {
                pdf.Workbook = xls;
                using (MemoryStream ms = new MemoryStream())
                {
                    pdf.BeginExport(ms);
                    pdf.ExportAllVisibleSheets(false, "BaoCao");
                    pdf.EndExport();
                    ms.Position = 0;
                    return File(ms.ToArray(), "application/pdf");
                }
            }
            return null;
        }
 /// <summary>
 /// Xuất báo cáo ra file PDF
 /// </summary>
 /// <param name="Nam">Năm làm việc</param>
 /// <param name="MaDV">Mã doanh nghiệp</param>
 /// <returns></returns>
 public clsExcelResult ExportToPDF(String Quy, String Nam, String MaDN)
 {
     HamChung.Language();
     clsExcelResult clsResult = new clsExcelResult();
     ExcelFile xls = CreateReport(Server.MapPath(sFilePath),Quy,Nam,MaDN);
     using (FlexCelPdfExport pdf = new FlexCelPdfExport())
     {
         pdf.Workbook = xls;
         using (MemoryStream ms = new MemoryStream())
         {
             pdf.BeginExport(ms);
             pdf.ExportAllVisibleSheets(false, "AA");
             pdf.EndExport();
             ms.Position = 0;
             clsResult.FileName = "Test.pdf";
             clsResult.type = "pdf";
             clsResult.ms = ms;
             return clsResult;
         }
     }
 }
Ejemplo n.º 10
0
        /// <summary>
        /// xem PDF
        /// </summary>
        /// <param name="NamLamViec"></param>
        /// <param name="iID_MaDonVi"></param>
        /// <param name="dNgayCapPhat"></param>
        /// <param name="iDM_MaLoaiCapPhat"></param>
        /// <param name="LuyKe"></param>
        /// <param name="LoaiBaoCao"></param>
        /// <returns></returns>
        public ActionResult ViewPDF(String iID_MaTrangThaiDuyet, String iID_MaDonVi, String dNgayCapPhat, String iDM_MaLoaiCapPhat, String LuyKe, String LoaiBaoCao)
        {
            HamChung.Language();
            String DuongDan = "";
            if (LoaiBaoCao == "Muc")
            {
                DuongDan = sFilePathMuc;
            }
            else if (LoaiBaoCao == "TieuMuc")
            {
                DuongDan = sFilePathTieuMuc;
            }
            else
            {
                DuongDan = sFilePathNganh;
            }
            ExcelFile xls = CreateReport(Server.MapPath(DuongDan), iID_MaTrangThaiDuyet, iID_MaDonVi, dNgayCapPhat, iDM_MaLoaiCapPhat, LuyKe, LoaiBaoCao);
            using (FlexCelPdfExport pdf = new FlexCelPdfExport())
            {
                pdf.Workbook = xls;
                using (MemoryStream ms = new MemoryStream())
                {
                    pdf.BeginExport(ms);
                    pdf.ExportAllVisibleSheets(false, "BaoCao");
                    pdf.EndExport();
                    ms.Position = 0;
                    return File(ms.ToArray(), "application/pdf");
                }

            }
            return null;
        }
        /// <summary>
        ///  Hiển thị báo cáo theo định dạng PDF
        /// </summary>
        /// <param name="MaND"></param>
        /// <param name="iThang_Quy"></param>
        /// <param name="sLNS"></param>
        /// <param name="iID_MaDonVi"></param>
        /// <param name="iID_MaNamNganSach"></param>
        /// <param name="LoaiBaoCao"></param>
        /// <param name="iID_MaPhongBan"></param>
        /// <param name="iID_TuyChon"></param>
        /// <returns></returns>
        /// HungPH: 18/11/2015
        public ActionResult ViewPDF(String MaND, String iThang_Quy, String sLNS, String iID_MaDonVi, String iID_MaNamNganSach, String LoaiBaoCao, String iID_MaPhongBan, String iID_TuyChon)
        {
            HamChung.Language();
            String sDuongDan = "";

            if (LoaiBaoCao == "ChiTiet")
            {
                sDuongDan = sFilePath;
            }
            else
            {
                if (iID_TuyChon == "1")
                {
                    sDuongDan = sFilePath_TongHop;
                }
                else if (iID_TuyChon == "2")
                {
                    sDuongDan = sFilePath_TongHop_denLNS;
                }
                else if (iID_TuyChon == "3")
                {
                    sDuongDan = sFilePath_TongHop_denM;
                }
                else if (iID_TuyChon == "4")
                {
                    sDuongDan = sFilePath_TongHop_denTM;
                }
            }

            ExcelFile xls = CreateReport(Server.MapPath(sDuongDan), MaND, sLNS, iThang_Quy, iID_MaDonVi, iID_MaNamNganSach, LoaiBaoCao, iID_MaPhongBan);
            using (FlexCelPdfExport pdf = new FlexCelPdfExport())
            {
                pdf.Workbook = xls;
                using (MemoryStream ms = new MemoryStream())
                {
                    pdf.BeginExport(ms);
                    pdf.ExportAllVisibleSheets(false, "BaoCao");
                    pdf.EndExport();
                    ms.Position = 0;
                    return File(ms.ToArray(), "application/pdf");
                }
            }
        }
Ejemplo n.º 12
0
        /// <summary>
        /// hàm xuất dữ liệu ra file PDF
        /// </summary>
        /// <param name="iID_MaDonVi"></param>
        /// <param name="iID_MaTrangThaiDuyet"></param>
        /// <returns></returns>
        public clsExcelResult ExportToPDF( String iID_MaTrangThaiDuyet, String iID_MaSanPham, String iID_MaChiTietGia)
        {
            clsExcelResult clsResult = new clsExcelResult();
            ExcelFile xls = CreateReport(Server.MapPath(sFilePath),  iID_MaTrangThaiDuyet, iID_MaSanPham, iID_MaChiTietGia);
            using (FlexCelPdfExport pdf = new FlexCelPdfExport())
            {
                pdf.Workbook = xls;
                using (MemoryStream ms = new MemoryStream())
                {
                    pdf.BeginExport(ms);
                    pdf.ExportAllVisibleSheets(false, "AA");
                    pdf.EndExport();
                    ms.Position = 0;
                    clsResult.FileName = "Test.pdf";
                    clsResult.type = "pdf";
                    clsResult.ms = ms;
                    return clsResult;
                }

            }
        }
        public ActionResult ViewPDF(String MaND, String iID_MaTrangThaiDuyet, String iNgay, String iThang, String DonViTinh, String NoiDung)
        {
            HamChung.Language();
            String DuongDanFile = "";
            if (NoiDung == "-1")
            {
                DuongDanFile = sFilePath;

            }
            else if (NoiDung == "0")
            {
                DuongDanFile = sFilePath_NT;

            }
            else
            {
                DuongDanFile = sFilePath_TV;
            }

            ExcelFile xls = CreateReport(Server.MapPath(DuongDanFile), MaND, iID_MaTrangThaiDuyet, iNgay, iThang, DonViTinh, NoiDung);
            using (FlexCelPdfExport pdf = new FlexCelPdfExport())
            {
                pdf.Workbook = xls;
                using (MemoryStream ms = new MemoryStream())
                {
                    pdf.BeginExport(ms);
                    pdf.ExportAllVisibleSheets(false, "BaoCao");
                    pdf.EndExport();
                    ms.Position = 0;
                    return File(ms.ToArray(), "application/pdf");
                }
            }
            return null;
        }
 /// <summary>
 /// Hiện thị báo cáo theo định dạng PDF
 /// </summary>        
 /// <param name="iLoaiThang_Quy">0: Chọn tháng | 1: Chọn quý</param>
 /// <param name="iThang">Tháng</param>
 /// <param name="iQuy">Quý</param>
 /// <param name="iNguonNS">Nguồn ngân sách</param>
 /// <param name="iMuc_TieuMuc">In đến mức: Mục | Tiểu mục</param>
 /// <param name="MaND">Năm</param>
 /// <returns></returns>
 public ActionResult ViewPDF(String iLoaiThang_Quy, String iThang, String iQuy, String iNguonNS, String iMuc_TieuMuc, String MaND, String iTrangThai)
 {
     HamChung.Language();
     ExcelFile xls = CreateReport(Server.MapPath(sFilePath), iLoaiThang_Quy, iThang, iQuy, iNguonNS, iMuc_TieuMuc, MaND,iTrangThai);
     using (FlexCelPdfExport pdf = new FlexCelPdfExport())
     {
         pdf.Workbook = xls;
         using (MemoryStream ms = new MemoryStream())
         {
             pdf.BeginExport(ms);
             pdf.ExportAllVisibleSheets(false, "BaoCao");
             pdf.EndExport();
             ms.Position = 0;
             return File(ms.ToArray(), "application/pdf");
         }
     }
     return null;
 }
 public ActionResult ViewPDF(String iID_MaDotCapPhat, String iLoai, String sNoiDung)
 {
     HamChung.Language();
     String DuongDan = "";
     if (iLoai == "1")
         DuongDan = sFilePath_ThanhToan;
     else
         DuongDan = sFilePath_TamUng;
     ExcelFile xls = CreateReport(Server.MapPath(DuongDan), iID_MaDotCapPhat, iLoai, sNoiDung);
     using (FlexCelPdfExport pdf = new FlexCelPdfExport())
     {
         pdf.Workbook = xls;
         using (MemoryStream ms = new MemoryStream())
         {
             pdf.BeginExport(ms);
             pdf.ExportAllVisibleSheets(false, "BaoCao");
             pdf.EndExport();
             ms.Position = 0;
             return File(ms.ToArray(), "application/pdf");
         }
     }
     return null;
 }
Ejemplo n.º 16
0
        private void btnCreateAndSign_Click(object sender, EventArgs e)
        {
            //Load the Excel file.
            if (OpenExcelDialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            XlsFile xls = new XlsFile();

            xls.Open(OpenExcelDialog.FileName);

            string DataPath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\..\..\";

            //Export it to pdf.
            using (FlexCelPdfExport pdf = new FlexCelPdfExport(xls, true))
            {
                pdf.FontEmbed = TFontEmbed.Embed;

                //Load the certificate and create a signer.
                //In this example we just have the password in clear. It should be kept in a SecureString.
                //Also make sure to set the flag X509KeyStorageFlags.EphemeralKeySet to avoid files created
                //on disk: https://snede.net/the-most-dangerous-constructor-in-net/
                //As X509KeyStorageFlags.EphemeralKeySet only exists in .NET 4.8 or newer, for older versions we will
                //define it as (X509KeyStorageFlags)32. For .NET 4.8 or newer and  NET Core, you can use X509KeyStorageFlags.EphemeralKeySet
                X509Certificate2 Cert = new X509Certificate2(DataPath + "flexcel.pfx", "password", X509KeyStorageFlags.EphemeralKeySet);

                //Note that to use the CmsSigner class you need to add a reference to System.Security dll.
                //It is *not* enough to add it to the using clauses, you need to add a reference to the dll.
                CmsSigner Signer = new CmsSigner(Cert);

                //By default CmsSigner uses SHA1, but SHA1 has known vulnerabilities and it is deprecated.
                //So we will use SHA512 instead.
                //"2.16.840.1.101.3.4.2.3" is the Oid for SHA512.
                Signer.DigestAlgorithm = new System.Security.Cryptography.Oid("2.16.840.1.101.3.4.2.3");

                TPdfSignature sig;
                if (cbVisibleSignature.Checked)
                {
                    using (MemoryStream fs = new MemoryStream())
                    {
                        SignaturePicture.Image.Save(fs, ImageFormat.Png);
                        byte[] ImgData = fs.ToArray();

                        //The -1 as "page" parameter means the last page.
                        sig = new TPdfVisibleSignature(new TBuiltInSignerFactory(Signer),
                                                       "Signature", "I have read the document and certify it is valid.", "Springfield", "*****@*****.**", -1, new RectangleF(50, 50, 140, 70), ImgData);
                    }
                }
                else
                {
                    sig = new TPdfSignature(new TBuiltInSignerFactory(Signer),
                                            "Signature", "I have read the document and certify it is valid.", "Springfield", "*****@*****.**");
                }

                //You must sign the document *BEFORE* starting to write it.
                pdf.Sign(sig);

                if (savePdfDialog.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                using (FileStream PdfStream = new FileStream(savePdfDialog.FileName, FileMode.Create))
                {
                    pdf.BeginExport(PdfStream);
                    pdf.ExportAllVisibleSheets(false, "Signed Pdf");
                    pdf.EndExport();
                }
            }

            if (MessageBox.Show("Do you want to open the generated file?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
            {
                return;
            }
            Process.Start(savePdfDialog.FileName);
        }
        /// <summary>
        /// Xem PDF
        /// </summary>
        /// <param name="NamLamViec"></param>
        /// <param name="iID_MaDonVi"></param>
        /// <returns></returns>
        public ActionResult ViewPDF(String MaND, String iID_MaDonVi, String iID_MaDanhMuc, String sLNS, String iID_MaTrangThaiDuyet, String Check)
        {
            HamChung.Language();
            String sFilePath = "";
            if (Check == "off")
            {
                sFilePath = "/Report_ExcelFrom/DuToan/rptDT_ChiNganSachSD_II_02.xls";
            }
            else
            {
                sFilePath = "/Report_ExcelFrom/DuToan/rptDT_Chi_SuDungNganSachNam.xls";
            }
            ExcelFile xls = CreateReport(Server.MapPath(sFilePath), MaND, iID_MaDonVi, iID_MaDanhMuc, sLNS, iID_MaTrangThaiDuyet, Check);
            using (FlexCelPdfExport pdf = new FlexCelPdfExport())
            {
                pdf.Workbook = xls;
                using (MemoryStream ms = new MemoryStream())
                {
                    pdf.BeginExport(ms);
                    pdf.ExportAllVisibleSheets(false, "BaoCao");
                    pdf.EndExport();
                    ms.Position = 0;
                    return File(ms.ToArray(), "application/pdf");
                }

            }
            return null;
        }
        /// <summary>
        /// Xuất ra PDF
        /// </summary>
        /// <param name="NamLamViec"></param>
        /// <param name="iID_MaDonVi"></param>
        /// <param name="DotPhanBo"></param>
        /// <returns></returns>
        public clsExcelResult ExportToPDF(String iID_MaDonVi, String DotPhanBo, String iID_MaTrangThaiDuyet)
        {
            String DuongDanFile = sFilePath;

            clsExcelResult clsResult = new clsExcelResult();
            ExcelFile xls = CreateReport(Server.MapPath(DuongDanFile), iID_MaDonVi, DotPhanBo,iID_MaTrangThaiDuyet);
            using (FlexCelPdfExport pdf = new FlexCelPdfExport())
            {
                pdf.Workbook = xls;
                using (MemoryStream ms = new MemoryStream())
                {
                    pdf.BeginExport(ms);
                    pdf.ExportAllVisibleSheets(false, "AA");
                    pdf.EndExport();
                    ms.Position = 0;
                    clsResult.FileName = "Test.pdf";
                    clsResult.type = "pdf";
                    clsResult.ms = ms;
                    return clsResult;
                }

            }
        }
 public ActionResult ViewPDF(String NamLamViec, String ThangLamViec, String TrangThai)
 {
     HamChung.Language();
     String DuongDanFile = sFilePath_A3;
     ExcelFile xls = CreateReport(Server.MapPath(DuongDanFile), NamLamViec, ThangLamViec, TrangThai);
     using (FlexCelPdfExport pdf = new FlexCelPdfExport())
     {
         pdf.Workbook = xls;
         using (MemoryStream ms = new MemoryStream())
         {
             pdf.BeginExport(ms);
             pdf.ExportAllVisibleSheets(false, "BaoCao");
             pdf.EndExport();
             ms.Position = 0;
             return File(ms.ToArray(), "application/pdf");
         }
     }
     return null;
 }
        /// <summary>
        /// Hiển thị báo cáo theo định dạng PDF
        /// </summary>
        /// <param name="NamLamViec"></param>
        /// <param name="iID_MaDonVi"></param>
        /// <returns></returns>
        public ActionResult ViewPDF(String MaND, String iQuy, String bTrongKy, String iID_MaDoanhNghiep, String iLoai, String DVT)
        {
            HamChung.Language();
            String sDuongDan = "";
            if (iLoai == "0")
            {
                sDuongDan = sFilePath_HoSoDoanhNghiep;
            }
            else if(iLoai=="4")
            {
                sDuongDan = sFilePath_Loai4;
            }
            else
            {
                sDuongDan = sFilePath;
            }

            ExcelFile xls = CreateReport(Server.MapPath(sDuongDan), MaND, iQuy, bTrongKy, iID_MaDoanhNghiep, iLoai, DVT);
            using (FlexCelPdfExport pdf = new FlexCelPdfExport())
            {
                pdf.Workbook = xls;
                using (MemoryStream ms = new MemoryStream())
                {
                    pdf.BeginExport(ms);
                    pdf.ExportAllVisibleSheets(false, "BaoCao");
                    pdf.EndExport();
                    ms.Position = 0;
                    return File(ms.ToArray(), "application/pdf");
                }
            }
            return null;
        }
 public clsExcelResult ExportToPDF(String NamLamViec, String Thang_Quy, String LoaiThang_Quy, String inmuc, String iID_MaNguonNganSach, String iID_MaNamNganSach, String iID_MaTrangThaiDuyet)
 {
     HamChung.Language();
     String DuongDan = "";
     DuongDan = PathFile(inmuc, DuongDan);
     clsExcelResult clsResult = new clsExcelResult();
     ExcelFile xls = CreateReport(Server.MapPath(DuongDan), NamLamViec, Thang_Quy, LoaiThang_Quy, inmuc, iID_MaNguonNganSach, iID_MaNamNganSach, iID_MaTrangThaiDuyet);
     using (FlexCelPdfExport pdf = new FlexCelPdfExport())
     {
         pdf.Workbook = xls;
         using (MemoryStream ms = new MemoryStream())
         {
             pdf.BeginExport(ms);
             pdf.ExportAllVisibleSheets(false, "AA");
             pdf.EndExport();
             ms.Position = 0;
             clsResult.FileName = "Test.pdf";
             clsResult.type = "pdf";
             clsResult.ms = ms;
             return clsResult;
         }
     }
 }
        public ActionResult ViewPDF(String iNam, String iThang,String optThu,String optTamUng,String optTra,String KhoGiay)
        {
            HamChung.Language();
            String DuongDan = "";
            if (KhoGiay == "1") DuongDan = sFilePath_a3;
            else DuongDan = sFilePath_a4;
            ExcelFile xls = CreateReport(Server.MapPath(DuongDan), iNam, iThang, optThu, optTamUng, optTra,KhoGiay);

            using (FlexCelPdfExport pdf = new FlexCelPdfExport())
            {
                pdf.Workbook = xls;
                using (MemoryStream ms = new MemoryStream())
                {
                    pdf.BeginExport(ms);
                    pdf.ExportAllVisibleSheets(false, "BaoCao");
                    pdf.EndExport();
                    ms.Position = 0;
                    return File(ms.ToArray(), "application/pdf");
                }
            }
            return null;
        }
Ejemplo n.º 23
0
        public clsExcelResult ExportToPDF(String iID_MaTrangThaiDuyet, String iID_MaDonVi, String dNgayCapPhat, String iDM_MaLoaiCapPhat, String LuyKe, String LoaiBaoCao)
        {
            HamChung.Language();
            String DuongDan = "";
            if (LoaiBaoCao == "Muc")
            {
                DuongDan = sFilePathMuc;
            }
            else if (LoaiBaoCao == "TieuMuc")
            {
                DuongDan = sFilePathTieuMuc;
            }
            else
            {
                DuongDan = sFilePathNganh;
            }
            clsExcelResult clsResult = new clsExcelResult();
            ExcelFile xls = CreateReport(Server.MapPath(DuongDan), iID_MaTrangThaiDuyet, iID_MaDonVi, dNgayCapPhat, iDM_MaLoaiCapPhat, LuyKe, LoaiBaoCao);
            using (FlexCelPdfExport pdf = new FlexCelPdfExport())
            {
                pdf.Workbook = xls;
                using (MemoryStream ms = new MemoryStream())
                {
                    pdf.BeginExport(ms);
                    pdf.ExportAllVisibleSheets(false, "AA");
                    pdf.EndExport();
                    ms.Position = 0;
                    clsResult.FileName = "Test.pdf";
                    clsResult.type = "pdf";
                    clsResult.ms = ms;
                    return clsResult;
                }

            }
        }
        public ActionResult ViewPDF(String iThang, String iID_MaDonVi, String UserName, String iID_MaTrangThaiDuyet)
        {
            HamChung.Language();
            string lang = "vi-VN";
            System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.CreateSpecificCulture(lang);
            System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.CreateSpecificCulture(lang);
            ExcelFile xls = CreateReport(Server.MapPath(sFilePath), iThang, iID_MaDonVi, UserName, iID_MaTrangThaiDuyet);

            using (FlexCelPdfExport pdf = new FlexCelPdfExport())
            {
                pdf.Workbook = xls;
                using (MemoryStream ms = new MemoryStream())
                {
                    pdf.BeginExport(ms);
                    pdf.ExportAllVisibleSheets(false, "BaoCao");
                    pdf.EndExport();
                    ms.Position = 0;
                    return File(ms.ToArray(), "application/pdf");
                }
            }
            return null;
        }
 /// <summary>
 /// Xem File PDF
 /// </summary>
 /// <param name="NamLamViec"></param>
 /// <param name="ThangLamViec"></param>
 /// <param name="iID_MaDonVi"></param>
 /// <returns></returns>
 public ActionResult ViewPDF(String NgoaiTe, string vidDenNgay)
 {
     //ViewData["bBaoCaoTH"] = "False";
     String DuongDanFile = sFilePath;
     // DateTime dNgay = Convert.ToDateTime(CommonFunction.LayNgayTuXau(vidDenNgay));
     ExcelFile xls = CreateReport(Server.MapPath(DuongDanFile), NgoaiTe, vidDenNgay);
     using (FlexCelPdfExport pdf = new FlexCelPdfExport())
     {
         pdf.Workbook = xls;
         using (MemoryStream ms = new MemoryStream())
         {
             pdf.BeginExport(ms);
             pdf.ExportAllVisibleSheets(false, "BaoCao");
             pdf.EndExport();
             ms.Position = 0;
             return File(ms.ToArray(), "application/pdf");
         }
     }
     return null;
 }
        /// <summary>
        /// Xuất file PDF quyết toán của từng đơn vị
        /// </summary>
        /// <param name="MaND">Mã người dùng</param>
        /// <param name="iThang_Quy">Quý</param>
        /// <param name="sLNS">Loại ngân sách</param>
        /// <param name="iID_MaDonVi">Mã đơn vị</param>
        /// <param name="iID_MaNamNganSach">Năm ngân sách</param>
        /// <param name="MaPhongBan">Mã phòng ban</param>
        /// <returns></returns>
        public ActionResult ViewPDF(String MaND, String iThang_Quy, String sLNS, String iID_MaDonVi, String iID_MaNamNganSach, String MaPhongBan)
        {
            HamChung.Language();
            String sDuongDan = "";
            sDuongDan = EXCEL_FILE_PATH;

            ExcelFile xls = CreateReport(Server.MapPath(sDuongDan), MaND, sLNS, iThang_Quy, iID_MaDonVi, iID_MaNamNganSach, MaPhongBan);
            using (FlexCelPdfExport pdf = new FlexCelPdfExport())
            {
                pdf.Workbook = xls;
                using (MemoryStream ms = new MemoryStream())
                {
                    pdf.BeginExport(ms);
                    pdf.ExportAllVisibleSheets(false, "BaoCao");
                    pdf.EndExport();
                    ms.Position = 0;
                    return File(ms.ToArray(), "application/pdf");
                }
            }
        }
 /// <summary>
 /// Hiển thị báo cáo theo định dạng file PDF
 /// </summary>
 /// <param name="Nam">Năm làm việc</param>
 /// <param name="MaDN">Mã doanh nghiệp</param>
 /// <returns></returns>
 public ActionResult ViewPDF(String Quy, String Nam, String MaDN)
 {
     HamChung.Language();
     ExcelFile xls = CreateReport(Server.MapPath(sFilePath), Quy, Nam, MaDN);
     using (FlexCelPdfExport pdf = new FlexCelPdfExport())
     {
         pdf.Workbook = xls;
         using (MemoryStream ms = new MemoryStream())
         {
             pdf.BeginExport(ms);
             pdf.ExportAllVisibleSheets(false, "BaoCao");
             pdf.EndExport();
             ms.Position = 0;
             return File(ms.ToArray(), "application/pdf");
         }
     }
     return null;
 }
        /// <summary>
        /// ExportToPDF
        /// </summary>
        /// <param name="NamLamViec"></param>
        /// <param name="iID_MaDonVi"></param>
        /// <param name="sLNS"></param>
        /// <param name="TongHop"></param>
        /// <returns></returns>
        public clsExcelResult ExportToPDF(String sLNS, String iID_MaDonVi, String Loai, String iID_MaTrangThaiDuyet, String UserName,String KhoGiay)
        {
            String sFilePath = "";
            if (Loai == "1")
            {
                if (KhoGiay == "1")
                {
                    sFilePath = "/Report_ExcelFrom/NguoiCoCong/rptNCC_TCKK_58_4.xls";
                }
                else
                {
                    sFilePath = "/Report_ExcelFrom/NguoiCoCong/rptNCC_TCKK_58_4_A3.xls";
                }
            }
            else
            {
                if (KhoGiay == "1")
                {
                    sFilePath = "/Report_ExcelFrom/NguoiCoCong/rptNCC_TCKK_58_4.xls";
                }
                else
                {
                    sFilePath = "/Report_ExcelFrom/NguoiCoCong/rptNCC_TCKK_58_4_A3.xls";
                }
            }
            String DuongDanFile = sFilePath;

            clsExcelResult clsResult = new clsExcelResult();
            ExcelFile xls = CreateReport(Server.MapPath(DuongDanFile), sLNS, iID_MaDonVi, Loai, iID_MaTrangThaiDuyet, UserName,KhoGiay);
            using (FlexCelPdfExport pdf = new FlexCelPdfExport())
            {
                pdf.Workbook = xls;
                using (MemoryStream ms = new MemoryStream())
                {
                    pdf.BeginExport(ms);
                    pdf.ExportAllVisibleSheets(false, "AA");
                    pdf.EndExport();
                    ms.Position = 0;
                    clsResult.FileName = "Test.pdf";
                    clsResult.type = "pdf";
                    clsResult.ms = ms;
                    return clsResult;
                }

            }
        }
        public clsExcelResult ExportToPDF(String MaND, String ThangQuy, String LoaiThang_Quy, String iID_MaDonVi, String iID_MaNhomDonVi, String LuyKe, String iID_MaTrangThaiDuyet, String KhoGiay, String BaoHiem,String iLoai)
        {
            clsExcelResult clsResult = new clsExcelResult();
            HamChung.Language();
            String sFilePath = "";
            if (KhoGiay == "0")
            {
                if (BaoHiem == "0" || BaoHiem == "1" || BaoHiem == "2")
                {
                    sFilePath = "/Report_ExcelFrom/BaoHiem/rptBH_TongQuyetToan1.xls";
                }
                else if (BaoHiem == "3")
                {
                    sFilePath = "/Report_ExcelFrom/BaoHiem/rptBH_TongQuyetToanCN.xls";
                }
                else if (BaoHiem == "4")
                {
                    sFilePath = "/Report_ExcelFrom/BaoHiem/rptBH_TongQuyetToanDV.xls";
                }
                else
                {
                    sFilePath = "/Report_ExcelFrom/BaoHiem/rptBH_TongQuyetToanTH.xls";
                }
            }

            else
            {

                if (BaoHiem == "0" || BaoHiem == "1" || BaoHiem == "2")
                {
                    sFilePath = "/Report_ExcelFrom/BaoHiem/rptBH_TongQuyetToan1A3.xls";
                }
                else if (BaoHiem == "3")
                {
                    sFilePath = "/Report_ExcelFrom/BaoHiem/rptBH_TongQuyetToanCNA3.xls";
                }
                else if (BaoHiem == "4")
                {
                    sFilePath = "/Report_ExcelFrom/BaoHiem/rptBH_TongQuyetToanDVA3.xls";
                }
                else
                {
                    sFilePath = "/Report_ExcelFrom/BaoHiem/rptBH_TongQuyetToanTH.xls";
                }
            }
            ExcelFile xls = CreateReport(Server.MapPath(sFilePath), MaND, ThangQuy, LoaiThang_Quy, iID_MaDonVi, iID_MaNhomDonVi, LuyKe, iID_MaTrangThaiDuyet, KhoGiay, BaoHiem,iLoai);
            using (FlexCelPdfExport pdf = new FlexCelPdfExport())
            {
                pdf.Workbook = xls;
                using (MemoryStream ms = new MemoryStream())
                {
                    pdf.BeginExport(ms);
                    pdf.ExportAllVisibleSheets(false, "AA");
                    pdf.EndExport();
                    ms.Position = 0;
                    clsResult.FileName = "Test.pdf";
                    clsResult.type = "pdf";
                    clsResult.ms = ms;
                    return clsResult;
                }

            }
        }
 /// <summary>
 /// ViewPDF
 /// </summary>
 /// <param name="NamLamViec"></param>
 /// <param name="iID_MaDonVi"></param>
 /// <param name="sLNS"></param>
 /// <param name="TongHop"></param>
 /// <returns></returns>
 public ActionResult ViewPDF(String sLNS, String iID_MaDonVi, String Loai, String iID_MaTrangThaiDuyet, String UserName,String KhoGiay)
 {
     HamChung.Language();
     String sFilePath = "";
     if (Loai == "1")
     {
         if (KhoGiay == "1")
         {
             sFilePath = "/Report_ExcelFrom/NguoiCoCong/rptNCC_TCKK_58_4.xls";
         }
         else
         {
             sFilePath = "/Report_ExcelFrom/NguoiCoCong/rptNCC_TCKK_58_4_A3.xls";
         }
     }
     else
     {
         if (KhoGiay == "1")
         {
             sFilePath = "/Report_ExcelFrom/NguoiCoCong/rptNCC_TCKK_58_4.xls";
         }
         else
         {
             sFilePath = "/Report_ExcelFrom/NguoiCoCong/rptNCC_TCKK_58_4_A3.xls";
         }
     }
     String DuongDanFile = sFilePath;
     ExcelFile xls = CreateReport(Server.MapPath(DuongDanFile), sLNS, iID_MaDonVi, Loai, iID_MaTrangThaiDuyet, UserName,KhoGiay);
     using (FlexCelPdfExport pdf = new FlexCelPdfExport())
     {
         pdf.Workbook = xls;
         using (MemoryStream ms = new MemoryStream())
         {
             pdf.BeginExport(ms);
             pdf.ExportAllVisibleSheets(false, "BaoCao");
             pdf.EndExport();
             ms.Position = 0;
             return File(ms.ToArray(), "application/pdf");
         }
     }
     return null;
 }
        //public ActionResult ViewPDF(String MaND, String sLNS, String iID_MaDonVi, String iID_MaDot,
        //        String iID_MaPhongBan, String LoaiTongHop)
        /// <summary>
        /// Xuất file pdf báo cáo dự toán tổng hợp chọn phòng ban đơn vị
        /// </summary>
        /// <param name="maND">Mã người dùng</param>
        /// <param name="sLNS">Loại ngân sách</param>
        /// <param name="maDonVi">Mã đơn vị</param>
        /// <param name="maDot">Mã đợt cấp phát</param>
        /// <param name="maPhongBan">Mã phòng ban</param>
        /// <param name="loaiBaoCao">Chọn báo cáo xuất ra là tổng hợp hay chi tiết</param>
        /// <returns></returns>
        public ActionResult ViewPDF(String maND, String sLNS, String maDonVi, String maDot,
                    String maPhongBan, String loaiBaoCao)
        {
            HamChung.Language();
            String sDuongDan = "";

            //Xuất báo cáo chi tiết
            if (loaiBaoCao == "ChiTiet")
            {
                sDuongDan = sFilePath_ChiTiet;
            }
            //Xuất báo cáo tổng hợp
            else
            {
                sDuongDan = sFilePath_TongHop;
            }

            ExcelFile xls = CreateReport(Server.MapPath(sDuongDan), maND, sLNS, maDonVi, maDot, maPhongBan, loaiBaoCao);

            using (FlexCelPdfExport pdf = new FlexCelPdfExport())
            {
                pdf.Workbook = xls;
                using (MemoryStream ms = new MemoryStream())
                {
                    pdf.BeginExport(ms);
                    pdf.ExportAllVisibleSheets(false, "BaoCao");
                    pdf.EndExport();
                    ms.Position = 0;

                    return File(ms.ToArray(), "application/pdf");
                }
            }
        }
        public ActionResult ViewPDF(String iID_MaDotCapPhat, String MaND, String MaTien)
        {
            HamChung.Language();
            String DuongDanFile = sFilePath;

            ExcelFile xls = CreateReport(Server.MapPath(DuongDanFile), iID_MaDotCapPhat, MaND, MaTien);
            using (FlexCelPdfExport pdf = new FlexCelPdfExport())
            {
                pdf.Workbook = xls;
                using (MemoryStream ms = new MemoryStream())
                {
                    pdf.BeginExport(ms);
                    pdf.ExportAllVisibleSheets(false, "BaoCao");
                    pdf.EndExport();
                    ms.Position = 0;
                    return File(ms.ToArray(), "application/pdf");
                }
            }
            return null;
        }
        /// <summary>
        /// xuất ra PDF
        /// </summary>
        /// <param name="NamLamViec"></param>
        /// <param name="iID_MaDonVi"></param>
        /// <returns></returns>
        public clsExcelResult ExportToPDF(String MaND, String iID_MaDonVi, String iID_MaDanhMuc, String sLNS, String iID_MaTrangThaiDuyet, String Check)
        {
            HamChung.Language();
            clsExcelResult clsResult = new clsExcelResult();
            String sFilePath = "";
            if (Check == "off")
            {
                sFilePath = "/Report_ExcelFrom/DuToan/rptDT_ChiNganSachSD_II_02.xls";
            }
            else
            {
                sFilePath = "/Report_ExcelFrom/DuToan/rptDT_Chi_SuDungNganSachNam.xls";
            }
            ExcelFile xls = CreateReport(Server.MapPath(sFilePath), MaND, iID_MaDonVi, iID_MaDanhMuc, sLNS, iID_MaTrangThaiDuyet, Check);
            using (FlexCelPdfExport pdf = new FlexCelPdfExport())
            {
                pdf.Workbook = xls;
                using (MemoryStream ms = new MemoryStream())
                {
                    pdf.BeginExport(ms);
                    pdf.ExportAllVisibleSheets(false, "AA");
                    pdf.EndExport();
                    ms.Position = 0;
                    clsResult.FileName = "Test.pdf";
                    clsResult.type = "pdf";
                    clsResult.ms = ms;
                    return clsResult;
                }

            }
        }
        /// <summary>
        /// Xuất ra PDF
        /// </summary>
        /// <param name="NamLamViec"></param>
        /// <param name="ThangQuy"></param>
        /// <param name="iID_MaDonVi"></param>
        /// <param name="LoaiThangQuy"></param>
        /// <param name="sLNS"></param>
        /// <param name="TruongTien"></param>
        /// <returns></returns>
        public clsExcelResult ExportToPDF(String iID_MaPhongBan, String iID_MaTrangThaiDuyet, String Thang_Quy, String iID_MaDonVi, String LoaiThang_Quy, String sLNS, String TruongTien)
        {
            HamChung.Language();
            clsExcelResult clsResult = new clsExcelResult();
            ExcelFile xls = CreateReport(Server.MapPath(sFilePath), iID_MaPhongBan, iID_MaTrangThaiDuyet, Thang_Quy, iID_MaDonVi, LoaiThang_Quy, sLNS, TruongTien);
            using (FlexCelPdfExport pdf = new FlexCelPdfExport())
            {
                pdf.Workbook = xls;
                using (MemoryStream ms = new MemoryStream())
                {
                    pdf.BeginExport(ms);
                    pdf.ExportAllVisibleSheets(false, "AA");
                    pdf.EndExport();
                    ms.Position = 0;
                    clsResult.FileName = "Test.pdf";
                    clsResult.type = "pdf";
                    clsResult.ms = ms;
                    return clsResult;
                }

            }
        }
Ejemplo n.º 35
0
 //<summary>
 //Hàm View PDF
 //</summary>
 //<param name="NamLamViec"></param>
 //<param name="sLNS"></param>
 //<param name="iID_MaDotPhanBo"></param>
 //<param name="TruongTien"></param>
 //<returns></returns>
 public ActionResult ViewPDF(String MaND, String sLNS, String iID_MaDotPhanBo, String iID_MaTrangThaiDuyet, String TruongTien, String KhoGiay, String LuyKe, String ToSo)
 {
     HamChung.Language();
     String DuongDan = "";
     if (LuyKe != "on")
     {
         if (KhoGiay == "1")
         {
             if (ToSo == "1") DuongDan = sFilePath_A3_1_RG;
             else DuongDan = sFilePath_A3_2_RG;
         }
         else
         {
             if (ToSo == "1") DuongDan = sFilePath_A4_1_RG;
             else DuongDan = sFilePath_A4_2_RG;
         }
     }
     else
     {
         if (KhoGiay == "1")
         {
             if (ToSo == "1") DuongDan = sFilePath_A3_1;
             else DuongDan = sFilePath_A3_2;
         }
         else
         {
             if (ToSo == "1") DuongDan = sFilePath_A4_1;
             else DuongDan = sFilePath_A4_2;
         }
     }
     clsExcelResult clsResult = new clsExcelResult();
     ExcelFile xls = CreateReport(Server.MapPath(DuongDan), MaND, sLNS, iID_MaDotPhanBo, iID_MaTrangThaiDuyet, TruongTien, KhoGiay, LuyKe, ToSo);
     using (FlexCelPdfExport pdf = new FlexCelPdfExport())
     {
         pdf.Workbook = xls;
         using (MemoryStream ms = new MemoryStream())
         {
             pdf.BeginExport(ms);
             pdf.ExportAllVisibleSheets(false, "BaoCao");
             pdf.EndExport();
             ms.Position = 0;
             return File(ms.ToArray(), "application/pdf");
         }
     }
     return null;
 }
        /// <summary>
        /// Xem file PDF
        /// </summary>
        /// <param name="NamLamViec"></param>
        /// <param name="Thang_Quy"></param>
        /// <param name="iID_MaDonVi"></param>
        /// <param name="LoaiThang_Quy"></param>
        /// <param name="sLNS"></param>
        /// <param name="TruongTien"></param>
        /// <returns></returns>
        public ActionResult ViewPDF(String iID_MaPhongBan, String iID_MaTrangThaiDuyet, String Thang_Quy, String iID_MaDonVi, String LoaiThang_Quy, String sLNS, String TruongTien)
        {
            HamChung.Language();
            ExcelFile xls = CreateReport(Server.MapPath(sFilePath), iID_MaPhongBan, iID_MaTrangThaiDuyet, Thang_Quy, iID_MaDonVi, LoaiThang_Quy, sLNS, TruongTien);
            using (FlexCelPdfExport pdf = new FlexCelPdfExport())
            {
                pdf.Workbook = xls;
                using (MemoryStream ms = new MemoryStream())
                {
                    pdf.BeginExport(ms);
                    pdf.ExportAllVisibleSheets(false, "BaoCao");
                    pdf.EndExport();
                    ms.Position = 0;
                    return File(ms.ToArray(), "application/pdf");
                }

            }
            return null;
        }