FastReportファイルとして保存

1442 ワード

 public void SaveToPDF(List model, string content, string saveFilePath)
        {
            if (model == null) return;

            Report report = new Report();
            report.LoadFromString(content);

            FillReport(report, model, "print");
            // 
            report.Prepare();
            PDFExport export = new PDFExport();
            report.Export(export, saveFilePath);
            report.Dispose();
        }

 /// 
        ///  ( )
        /// 
        ///  
        ///  
        public byte[] FileConvertByte(string filePath)
        {
            if (!File.Exists(filePath))
            {
                return null;
            }
            byte[] bytContent = null;
            System.IO.FileStream fs = null;
            System.IO.BinaryReader br = null;
            try
            {
                fs = new FileStream(filePath, System.IO.FileMode.Open);
                br = new BinaryReader((Stream)fs);
                bytContent = br.ReadBytes((Int32)fs.Length);
                fs.Close();
                br.Close();
            }
            catch
            {
                fs.Close();
                br.Close();
                return null;
            }
            return bytContent;
        }

  
転載先:https://www.cnblogs.com/YYkun/p/9603007.html