我做了一个代码来生成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#中有一个代码,并且必须打印一个带有卖家名字的标签,但我有一个问题.标签中的每一行都包含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)
谢谢您的帮助!