导出Crystal报表时的未终止字符串常量 [英] Unterminated String Constant When Exporting Crystal Report

查看:78
本文介绍了导出Crystal报表时的未终止字符串常量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在asp.net(Visual Studio 2003)中创建一个表单,然后将使用CrystalReportViewer将表单用于生成CrystalReport(Crystal Report XI).

表单非常简单,曾经用于将数据存储在数据库中,我在表单中使用多行文本框.我还使用以下代码将文本框中的换行符替换为html< br>标签

I''m creating a form in asp.net (Visual Studio 2003), the form then will be used to generate a CrystalReport (Crystal Report XI) by using CrystalReportViewer.

The form is quite simple that used to stored data in database, I''m using multiline textbox in the form. I also using the following code to replace the newline in the textbox into html <br> tag

.Replace(Environment.NewLine, "<br>")



代码工作正常,换行符更改为< br>.在数据库中.然后,我需要将存储的数据取回表单以进行编辑.然后,我使用以下代码替换< br>返回到文本框中的换行符.



The code is working fine, the newline is changed into <br> in the database. Then I need to fetch the stored data back into the form for editing purpose. I then use the following code to replace the <br> back into a newline in the textbox.

.Replace("<br>", Environment.NewLine)



然后,我在asp页面中生成CrystalReport.它已成功生成,当我尝试导出报告时会出现问题.它没有弹出必须的导出窗口,而是返回Unterminated string constant错误消息.

然后,我尝试更改用于替换< br>的代码.变成以下内容



Then I generate the CrystalReport in the asp page. It''s successfully generated, the problem occurs when I try to export the report. It doesn''t pop out an export window as it has to be, it returns an Unterminated string constant error message.

I then tried to change the code that used to replace the <br> into something like the following

.Replace("<br>", " ")


并且导出功能运行良好,因此我认为问题与Environment.Newline有关.但是我很难找到另一种方法来替换< br>标记,除非在ASP中使用Environment.Newline.你们可以帮我解决这个问题吗?


And the export function is working fine, so I think the problem is related to the Environment.Newline. But I was having a very hard time finding another way to replace the <br> tag except by using the Environment.Newline in the ASP. Do you guys can help me dealing with this issue ?

推荐答案

我已经为此工作了好几天,并假设问题出在Crystal Report导出上过程.如果Crystal Report Viewer位于同一页面中且表单中包含带有多行值的textarea,则Crystal Reports无法导出该报告.

我尝试使用许多换行符替换方法,包括SQL Replace函数,但没有一个方法可以解决问题.

最后,我决定显示报表,并将Crystal Report Viewer放在单独的页面中,现在一切恢复正常.

非常感谢您的帮助和回复,非常感谢.


I''ve been working on this for days, and assuming that the problem lies on the Crystal Report exporting process. The Crystal Report couldn''t export the report if the Crystal Report Viewer is in the same page with a form that contain a textarea with multiline value in it.

I''ve tried to use a lot of Newline replacement methods including the SQL Replace function but none of them could solve the problem.

Finally I decided to show the report and put the Crystal Report Viewer in a separated page, and things are now going back to work.

I would like to thank you for your help and responses, I really appreciate that.



我不确定您的Environment.NewLine返回什么(也许是因为您的区域设置而有些奇怪?!)

尝试解决方法,将Environment.NewLine替换为"\r\n"或仅将"\n"
I''m not sure what your Environment.NewLine is returning (maybe something weird because of your regional settings ?!)

Try a workaround, replacing Environment.NewLine with "\r\n" or just "\n"


这篇关于导出Crystal报表时的未终止字符串常量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆