Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #11686 > unrolled thread

Save RTF Text in ADS?

Started byJürgen Knauf <trotterklaus@googlemail.com>
First post2018-06-07 23:51 -0700
Last post2018-06-11 00:43 -0700
Articles 5 — 3 participants

Back to article view | Back to comp.lang.clipper.visual-objects


Contents

  Save RTF Text in ADS? Jürgen Knauf <trotterklaus@googlemail.com> - 2018-06-07 23:51 -0700
    Re: Save RTF Text in ADS? Martin <Martin@spam.spam> - 2018-06-08 13:10 +0100
    Re: Save RTF Text in ADS? Jürgen Knauf <trotterklaus@googlemail.com> - 2018-06-08 07:45 -0700
      Re: Save RTF Text in ADS? Sherlock <sherlock@sherlock.com.au> - 2018-06-11 00:28 -0700
        Re: Save RTF Text in ADS? Jürgen Knauf <trotterklaus@googlemail.com> - 2018-06-11 00:43 -0700

#11686 — Save RTF Text in ADS?

FromJürgen Knauf <trotterklaus@googlemail.com>
Date2018-06-07 23:51 -0700
SubjectSave RTF Text in ADS?
Message-ID<fbc4ff4f-1fd4-4d35-b727-c6db3fd5c888@googlegroups.com>
Hello,

can I save an RTF String directly in a memo field (Advantage Database) without using Blob-field with import und export?

Juergen

[toc] | [next] | [standalone]


#11690

FromMartin <Martin@spam.spam>
Date2018-06-08 13:10 +0100
Message-ID<pfdro4$sf6$1@dont-email.me>
In reply to#11686
Not worth it I do this

On save encode to base64

On load decode from base64

FUNCTION MDecodeBase64 (cText)

LOCAL cRet	AS STRING, ;
       nLen	AS DWORD, ;
       nLoop	AS DWORD, ;
       c1	AS STRING, ;
       c2	AS STRING, ;
       c3	AS STRING, ;
       c4	AS STRING, ;
       n1	AS INT, ;
       n2	AS INT, ;
       n3	AS INT, ;
       n4	AS INT, ;
       cC1	AS STRING, ;
       cC2	AS STRING, ;
       cC3	AS STRING, ;
       nC1A	AS INT, ;
       nC1B	AS INT, ;
       nC2A	AS INT, ;
       nC2B	AS INT, ;
       nC3A	AS INT


cRet	:= ''

IF Empty(ctext)
	RETURN ''
ENDIF

nLen	:= SLen(cText)

FOR nLoop := 0 TO nLen-4 STEP 4
	c1	:= SubStr(cText,nLoop+1,1)	
	c2	:= SubStr(cText,nLoop+2,1)	
	c3	:= SubStr(cText,nLoop+3,1)	
	c4	:= SubStr(cText,nLoop+4,1)	

	n1	:= B64CtoN(c1)
	n2	:= B64CtoN(c2)
	n3	:= B64CtoN(c3)
	n4	:= B64CtoN(c4)

	nC1A	:= n1 << 2
	nC1B	:= _And(n2,0x30) >> 4

	nC2A	:= _And(n2,0x0F) << 4
	nC2B	:= _And(n3,0x3c) >> 2

	nC3A	:= _And(n3,0x03) << 6

	cC1		:= Chr(DWORD(_Cast,(nC1A + nC1B)))	

	IF c3 <> '=='
		cC2	:= Chr(DWORD(_Cast,(nC2A + nC2B)))
	ELSE
		cC2	:= ''
	ENDIF

	IF c4 <> '=='
		cC3	:= Chr(DWORD(_Cast,(nC3A + n4)))
	ELSE
		cC3	:= ''
	ENDIF

	cRet	+= cC1+cC2+cC3
NEXT


RETURN cRet
FUNCTION MEncodeBase64 (cText)

LOCAL cRet	AS STRING, ;
       nLen	AS DWORD, ;
       nLeft	AS DWORD, ;
       nLoop	AS DWORD, ;
       c1	AS STRING, ;
       c2	AS STRING, ;
       c3	AS STRING, ;
       n1	AS DWORD, ;
       n2	AS DWORD, ;
       n3	AS DWORD, ;
       n4	AS DWORD

LOCAL cIndex	:= 
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"

cRet	:= ''

IF Empty(ctext)
	RETURN ''
ENDIF

nLen	:= SLen(cText)
nLeft	:= nLen%3

//000000-00 0000-0000 00-000000
//000000 00-0000 0000-00 000000

nLen	-= nLeft
FOR nLoop := 0 TO nLen-3 STEP 3
	c1	:= SubStr(cText,nLoop+1,1)	
	c2	:= SubStr(cText,nLoop+2,1)	
	c3	:= SubStr(cText,nLoop+3,1)	

	n1	:= Asc(c1) >> 2
	n2	:= _Or(_And(Asc(c1),0x03) << 4,_And(Asc(c2),0xf0) >> 4)
	n3	:= _Or(_And(Asc(c2),0x0f) << 2,_And(Asc(c3),0xc0) >> 6)
	n4	:= _And(Asc(c3),0x3f)




	cRet	+= 
SubStr(cIndex,n1+1,1)+SubStr(cIndex,n2+1,1)+SubStr(cIndex,n3+1,1)+SubStr(cIndex,n4+1,1)
NEXT

DO CASE
	CASE nLeft = 1
		c1	:= SubStr(cText,nLen+1,1)	

		n1	:= Asc(c1) >> 2
		n2	:= _And(Asc(c1),0x03) << 4

		cRet	+= SubStr(cIndex,n1+1,1)+SubStr(cIndex,n2+1,1)+'=='

	CASE nLeft = 2
		c1	:= SubStr(cText,nLen+1,1)	
		c2	:= SubStr(cText,nLen+2,1)	

		n1	:= Asc(c1) >> 2
		n2	:= _Or(_And(Asc(c1),0x03) << 4,_And(Asc(c2),0xf0) >> 4)
		n3	:= _And(Asc(c2),0x0f) << 2

		cRet	+= 
SubStr(cIndex,n1+1,1)+SubStr(cIndex,n2+1,1)+SubStr(cIndex,n3+1,1)+'='


ENDCASE

// cRet	+= '\0'


RETURN cRet
FUNCTION B64CtoN (cChar)

LOCAL nPos	AS DWORD

nPos	:= 
At(cChar,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")
IF nPos > 0
	nPos--
ENDIF

RETURN nPos





On 08/06/2018 07:51, Jürgen Knauf wrote:
> Hello,
> 
> can I save an RTF String directly in a memo field (Advantage Database) without using Blob-field with import und export?
> 
> Juergen
> 

[toc] | [prev] | [next] | [standalone]


#11691

FromJürgen Knauf <trotterklaus@googlemail.com>
Date2018-06-08 07:45 -0700
Message-ID<434d5195-01c4-4990-8428-4fd0d563048d@googlegroups.com>
In reply to#11686
Am Freitag, 8. Juni 2018 08:51:21 UTC+2 schrieb Jürgen Knauf:
> Hello,
> 
> can I save an RTF String directly in a memo field (Advantage Database) without using Blob-field with import und export?
> 
> Juergen

Hi Martin,

I found out, that I can use a normal MemoField, without converting anything.

Thanks, Juergen

[toc] | [prev] | [next] | [standalone]


#11692

FromSherlock <sherlock@sherlock.com.au>
Date2018-06-11 00:28 -0700
Message-ID<449bbb26-9d72-4153-af83-e11d84314306@googlegroups.com>
In reply to#11691
Juergen

You can save just about anything in a FPT/DBV blob with or without a DBF.
Serialisation, encryption option depending on needs.

JSON or RTF or Serialised PHP.. a JPG maybe.
So all of these things.

Anything really.

With RTF you can also use the Clipboard to strip RTF back to txt is handy as well.

Phil

[toc] | [prev] | [next] | [standalone]


#11693

FromJürgen Knauf <trotterklaus@googlemail.com>
Date2018-06-11 00:43 -0700
Message-ID<e43c2557-976c-41d2-a369-d93a59eb339f@googlegroups.com>
In reply to#11692
Am Montag, 11. Juni 2018 09:28:24 UTC+2 schrieb Sherlock:
> Juergen
> 
> You can save just about anything in a FPT/DBV blob with or without a DBF.
> Serialisation, encryption option depending on needs.
> 
> JSON or RTF or Serialised PHP.. a JPG maybe.
> So all of these things.
> 
> Anything really.
> 
> With RTF you can also use the Clipboard to strip RTF back to txt is handy as well.
> 
> Phil

Hi Phil,

I know that you can save everything in blob fields. But for this the file must always be imported and exported. Especially with the ADT format in ADS. Wirh RTF ein can save it directly to the MEMO field.

Juergen

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.clipper.visual-objects


csiph-web