小编Joh*_*aes的帖子

在PDF中生成Crystal的报告...如何在新标签或页面中打开?

我做了一个代码来生成PDF格式的Crystal Reports报告......但是它在用户的同一页面打开并进行了搜索并点击了按钮...有办法在新标签或页面中打开PDF ?

我的代码是:

private void OpenPDF()
{
    ReportDocument Rel = new ReportDocument();
    Rel.Load(Server.MapPath("../Reports/Test.rpt"));
    BinaryReader stream = new BinaryReader(Rel.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat));
    Response.ClearContent();
    Response.ClearHeaders();
    Response.ContentType = "application/pdf";
    Response.BinaryWrite(stream.ReadBytes(Convert.ToInt32(stream.BaseStream.Length)));
    Response.Flush();
    Response.Close(); 
}
Run Code Online (Sandbox Code Playgroud)

谢谢您的帮助!

c# pdf visual-studio-2010 crystal-reports

9
推荐指数
1
解决办法
1万
查看次数

在C#中操作字符串

我在C#中有一个代码,并且必须打印一个带有卖家名字的标签,但我有一个问题.标签中的每一行都包含20个字母,我有2行代表这个名字.

我需要在2行中安排卖家的名字,不要切词.

例如 - 姓名:JOSE MAURICIO BERTOLOTO MENDES

Line1:JOSE MAURICIO

Line2:BERTOLOTO MENDES

有人知道我是怎么做到的吗?谢谢


编辑:根据答案,我实现了这段代码:

string[] SellerPrint = Seller.Split(' ');
Line1 = "";
Line2 = "";
foreach (string name in SellerPrint )
{
     if (Line1.Length <= 20)
     {
          if ((Line1 + name).Length <= 20)
               Line1 += (Line1.Length == 0) ? name : " " + name;
          else
               break;
     }
}
Line2 = (Seller.Replace(Line1, "").Length <= 20) ? Seller.Replace(Line1+ " ", "") : Seller.Replace(Line1+ " ", "").Remove(20);
Run Code Online (Sandbox Code Playgroud)

谢谢您的帮助!

c# string

-1
推荐指数
1
解决办法
327
查看次数

标签 统计

c# ×2

crystal-reports ×1

pdf ×1

string ×1

visual-studio-2010 ×1