我有一个Crystal Report,我在其中显示从DataSet
检索到的编码文本,但在报告中,它显示的是html标记。
有没有办法解码文本并将其显示在水晶报告中?
答案 0 :(得分:1)
这是我的SQL函数,用于解码编码文本..
CREATE FUNCTION FNHTMLDECODE (@REMARKS NVARCHAR(MAX))
RETURNS NVARCHAR(MAX) AS
BEGIN
DECLARE @RESULT NVARCHAR(MAX)
DECLARE @VCCRLF VARCHAR(2)
SET @VCCRLF = CHAR(13) + CHAR(10)
SELECT @RESULT = @REMARKS
SELECT @RESULT = REPLACE(@RESULT,'&','&')
SELECT @RESULT = REPLACE(@RESULT,'&','&')
SELECT @RESULT = REPLACE(@RESULT,'&#','&#')
SELECT @RESULT = REPLACE(@RESULT,' ',' ')
SELECT @RESULT = REPLACE(@RESULT,'<','<')
SELECT @RESULT = REPLACE(@RESULT,'>','>')
SELECT @RESULT = REPLACE(@RESULT,'"','"')
SELECT @RESULT = REPLACE(@RESULT,'©','©')
SELECT @RESULT = REPLACE(@RESULT,'&LAQUO;','«')
SELECT @RESULT = REPLACE(@RESULT,'&RAQUO;','»')
SELECT @RESULT = REPLACE(@RESULT,'&FRAC14;','¼')
SELECT @RESULT = REPLACE(@RESULT,'&FRAC12;','½')
SELECT @RESULT = REPLACE(@RESULT,'&IQUEST;','¿')
SELECT @RESULT = REPLACE(@RESULT,'<BR />', CHAR(10)) -- LINE FEED
SELECT @RESULT = REPLACE(@RESULT,'
', CHAR(13)) -- CARRIAGE RETURN
SELECT @RESULT = REPLACE(@RESULT,'<P>',@VCCRLF)
RETURN @RESULT
END