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


C# StiReport.Print方法代码示例

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


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

示例1: printStimulsoftReports

        /// <summary>
        /// 打印MRZ
        /// </summary>
        /// <param name="rptFiles">ftp文件</param>  
        /// <param name="dsSource">数据源</param>
        /// <param name="isPreview">是否预览</param>
        /// <returns></returns>
        public static string printStimulsoftReports(string rptFiles, DataSet dsSource, bool isPreview)
        {
            try
            {
                //处理下载多个文件的情形
                string lableFiles = rptFiles.Trim() + ",";
                string lFile = "";
                int filesCount = lableFiles.Length - lableFiles.Replace(",", String.Empty).Length;

                //对数据集重命名

                for (int i = 0; i < dsSource.Tables.Count; i++)
                {
                    dsSource.Tables[i].TableName = "t" + (i + 1).ToString();
                }

                StiReport report = new StiReport();

                for (int i = 0; i < filesCount; i++)  //连续打印
                {
                    lFile = lableFiles.Substring(0, lableFiles.IndexOf(","));
                    if (lFile.Trim() != "")
                    {
                        string LocalPath = Environment.GetEnvironmentVariable("TEMP") + "\\" + rptFiles;

                        if (System.IO.File.Exists(LocalPath) == true)
                        {

                            string rptFile = LocalPath;

                            report.Load(rptFile);

                            //对数据集重命名
                            for (int ii = 0; ii < dsSource.Tables.Count; ii++)
                            {
                                dsSource.Tables[ii].TableName = "t" + (ii + 1).ToString();
                            }

                            report.RegData(dsSource);
                            if (isPreview == false) report.PrinterSettings.ShowDialog = false;
                            report.Render(false);
                            if (isPreview == false)
                            {
                                report.Print();
                                File.Delete(LocalPath);
                            }
                            else
                            {
                                report.Show(true);
                                File.Delete(LocalPath);
                            }

                        }
                        else
                        {
                            return " RptReportServerURL + lFile, PlugInCommand";

                        }
                    }

                    lableFiles = lableFiles.Substring(lableFiles.IndexOf(",") + 1);
                }

            }

            catch (Exception er)
            {
                return er.ToString();

            }
            return "打印成功";
        }
开发者ID:ypfly,项目名称:AutoCount,代码行数:79,代码来源:PrintMRZ.cs

示例2: ShowReport

 private void ShowReport(bool isPrint, RepReport report)
 {
     System.IO.MemoryStream stream = null;
     System.Data.DataSet ds;
     string str;
     string str2;
     RepReportTemplate template;
     System.IO.FileInfo info;
     string str3;
     DbFileFormat format;
     if (report.PackedResult != null)
     {
         stream = new System.IO.MemoryStream(report.PackedResult);
     }
     GZipStream stream2 = null;
     if (stream != null)
     {
         stream2 = new GZipStream(stream, CompressionMode.Decompress);
     }
     if (report.IsSimpleTable || report.IsTxt)
     {
         if (isPrint)
         {
             System.Windows.Forms.MessageBox.Show("Невозможно распечатать данный тип отчета:" + System.Environment.get_NewLine() + report.ReportTemplateName);
             return;
         }
         ds = null;
         if (report.PlannedDate != AIS.SN.Model.Constants.NullDate)
         {
             System.Runtime.Serialization.Formatters.Binary.BinaryFormatter formatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
             ds = (System.Data.DataSet) formatter.Deserialize(stream2);
         }
         else
         {
             ds = report.ds;
         }
         if (stream2 != null)
         {
             stream2.Close();
         }
         if (((ds.Tables.get_Count() < 2) || (ds.Tables.get_Item(0).Rows.get_Count() == 0)) || (ds.Tables.get_Item(1).Rows.get_Count() == 0))
         {
             System.Windows.Forms.MessageBox.Show("Отчет пуст:" + System.Environment.get_NewLine() + report.ReportTemplateName);
             return;
         }
         str = ds.Tables.get_Item(0).Rows.get_Item(0).get_Item("filename").ToString();
         try
         {
             str2 = str.Substring(0, str.LastIndexOf(@"\"));
             str = str.Substring((int) (str.LastIndexOf(@"\") + 1));
         }
         catch (System.Exception)
         {
             str2 = @"C:\";
             str = "file.dbf";
         }
         if (System.IO.Directory.Exists(str2))
         {
             this.sfdDBF.set_InitialDirectory(str2);
         }
         this.sfdDBF.set_FileName(str);
         this.sfdDBF.set_DefaultExt(report.IsTxt ? ((string) "txt") : ((string) "dbf"));
         template = RepReportTemplate.FindById(report.ReportTemplateId);
         if (this.sfdDBF.ShowDialog(this) != System.Windows.Forms.DialogResult.OK)
         {
             return;
         }
         str = this.sfdDBF.get_FileName();
         if (System.IO.File.Exists(str) && !template.IsAppending)
         {
             System.IO.File.Delete(str);
         }
         info = new System.IO.FileInfo(str);
         System.Guid guid = System.Guid.NewGuid();
         ds.Tables.get_Item(1).set_TableName('A' + guid.ToString().Substring(0, 7).ToUpper());
         str2 = info.get_DirectoryName() + ((info.get_DirectoryName() == "") ? ((string) "") : ((string) @"\"));
         if (!report.IsSimpleTable)
         {
             goto Label_04FF;
         }
         str3 = str;
         if (template.IsAppending && info.get_Exists())
         {
             info.MoveTo(str2 + ds.Tables.get_Item(1).get_TableName() + ".DBF");
         }
         format = DbFileFormat.dBase3;
         string str5 = ds.Tables.get_Item(0).Rows.get_Item(0).get_Item("fileformat").ToString();
         if (str5 != null)
         {
             if (str5 == "dBase3")
             {
                 format = DbFileFormat.dBase3;
             }
             else if (str5 == "dBase4")
             {
                 format = DbFileFormat.dBase4;
             }
             else if (str5 == "dBase5")
             {
                 format = DbFileFormat.dBase5;
//.........这里部分代码省略.........
开发者ID:u4097,项目名称:SQLScript,代码行数:101,代码来源:ReportsMainForm.cs


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