8
0

FNDD_CONVERT_RTF2TEXT: Remove rtf format strings

This commit is contained in:
KammM 2025-06-06 16:53:17 +02:00
parent 98f440ec7c
commit cb0bc57fde

View File

@ -3,36 +3,37 @@ GO
SET QUOTED_IDENTIFIER ON SET QUOTED_IDENTIFIER ON
GO GO
-- [FNDD_CONVERT_RTF2Text] -- [FNDD_CONVERT_RTF2TEXT]
-- ================================================================= -- =================================================================
-- Converts a RTF text to a regular text -- Converts a RTF text to a regular text
-- --
-- Returns: NVARCHAR - 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 -- Digital Data GmbH • Ludwig-Rinn-Strasse 16 • D-35452 Heuchelheim
-- Tel.: 0641/202360 • E-Mail: info-flow@digitaldata.works -- Tel.: 0641/202360 • E-Mail: info-flow@digitaldata.works
-- ================================================================= -- =================================================================
-- Creation Date / Author: 26.09.2024 / HE,MK -- Creation Date / Author: 26.09.2024 / HE,MK
-- Version Date / Editor: 14.12.2024 / HE,MK -- Version Date / Editor: 25.03.2025 / HE,MK
-- Version Number: 1.1.0.0 -- Version Number: 1.2.0.0
-- ================================================================= -- =================================================================
-- History: -- History:
-- 26.09.2024 / HE,MK - First Version -- 26.09.2024 / HE,MK - First Version
-- 14.12.2024 / MK - code optimisation, new additional parameters -- 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 @pRTF nvarchar(max), -- Give the RTF text, you want to convert
@pREMOVE_LINE_WRAP BIT = 1, -- Set to 1 to remove line wraps @pREMOVE_LINE_WRAP BIT = NULL, -- Set to 1 to remove line wraps
@pREMOVE_DOUBLE_BLANKS BIT = 1 -- Set to 1 to remove unnecessary blanks @pREMOVE_DOUBLE_BLANKS BIT = NULL -- Set to 1 to remove unnecessary blanks
) )
RETURNS nvarchar(max) RETURNS nvarchar(max)
AS AS
BEGIN BEGIN
-- decalare new vars because of parameter sniffing -- 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_LINE_WRAP BIT = ISNULL(@pREMOVE_LINE_WRAP,1),
@REMOVE_DOUBLE_BLANKS BIT = ISNULL(@pREMOVE_DOUBLE_BLANKS,1); @REMOVE_DOUBLE_BLANKS BIT = ISNULL(@pREMOVE_DOUBLE_BLANKS,1);
@ -139,6 +140,9 @@ BEGIN
-- Anyway remove trailing spaces -- Anyway remove trailing spaces
SET @rtf = LTRIM(RTRIM(@rtf)); SET @rtf = LTRIM(RTRIM(@rtf));
-- Replace rtf format strings
SET @rtf = Replace(@rtf,'Riched20 10.0.17763} ','');
END; END;
RETURN @rtf; RETURN @rtf;