我有一个水晶报表,其中显示了从 a 检索到的编码文本DataSet
,但在报表中,它显示的是 html 标记。
有没有办法解码文本并将其显示在水晶报表中?
这是我用于解码编码文本的 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