From cb0bc57fde32bef9c7c0f3f9bee1257674889da0 Mon Sep 17 00:00:00 2001 From: KammM Date: Fri, 6 Jun 2025 16:53:17 +0200 Subject: [PATCH] FNDD_CONVERT_RTF2TEXT: Remove rtf format strings --- .../[FNDD_CONVERT_RTF2TEXT].sql | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/current/[FNDD_CONVERT_RTF2TEXT]/[FNDD_CONVERT_RTF2TEXT].sql b/current/[FNDD_CONVERT_RTF2TEXT]/[FNDD_CONVERT_RTF2TEXT].sql index e1e28ac..f75756e 100644 --- a/current/[FNDD_CONVERT_RTF2TEXT]/[FNDD_CONVERT_RTF2TEXT].sql +++ b/current/[FNDD_CONVERT_RTF2TEXT]/[FNDD_CONVERT_RTF2TEXT].sql @@ -3,36 +3,37 @@ GO SET QUOTED_IDENTIFIER ON GO --- [FNDD_CONVERT_RTF2Text] +-- [FNDD_CONVERT_RTF2TEXT] -- ================================================================= -- Converts a RTF text to a regular text -- -- Returns: NVARCHAR - text -- ================================================================= --- Copyright (c) 2024 by Digital Data GmbH +-- Copyright (c) 2025 by Digital Data GmbH -- -- Digital Data GmbH • Ludwig-Rinn-Strasse 16 • D-35452 Heuchelheim -- Tel.: 0641/202360 • E-Mail: info-flow@digitaldata.works -- ================================================================= -- Creation Date / Author: 26.09.2024 / HE,MK --- Version Date / Editor: 14.12.2024 / HE,MK --- Version Number: 1.1.0.0 +-- Version Date / Editor: 25.03.2025 / HE,MK +-- Version Number: 1.2.0.0 -- ================================================================= -- History: -- 26.09.2024 / HE,MK - First Version -- 14.12.2024 / MK - code optimisation, new additional parameters +-- 25.03.2025 / HE,MK - Remove rtf format strings -CREATE OR ALTER FUNCTION [dbo].[FNDD_CONVERT_RTF2Text]( +CREATE OR ALTER FUNCTION [dbo].[FNDD_CONVERT_RTF2TEXT]( @pRTF nvarchar(max), -- Give the RTF text, you want to convert - @pREMOVE_LINE_WRAP BIT = 1, -- Set to 1 to remove line wraps - @pREMOVE_DOUBLE_BLANKS BIT = 1 -- Set to 1 to remove unnecessary blanks + @pREMOVE_LINE_WRAP BIT = NULL, -- Set to 1 to remove line wraps + @pREMOVE_DOUBLE_BLANKS BIT = NULL -- Set to 1 to remove unnecessary blanks ) RETURNS nvarchar(max) AS BEGIN -- decalare new vars because of parameter sniffing - DECLARE @RTF NVARCHAR(256) = ISNULL(@pRTF,''), + DECLARE @RTF NVARCHAR(max) = ISNULL(@pRTF,''), @REMOVE_LINE_WRAP BIT = ISNULL(@pREMOVE_LINE_WRAP,1), @REMOVE_DOUBLE_BLANKS BIT = ISNULL(@pREMOVE_DOUBLE_BLANKS,1); @@ -139,6 +140,9 @@ BEGIN -- Anyway remove trailing spaces SET @rtf = LTRIM(RTRIM(@rtf)); + -- Replace rtf format strings + SET @rtf = Replace(@rtf,'Riched20 10.0.17763} ',''); + END; RETURN @rtf;