Page 1 of 2

Problem with variables

Posted: Tue Nov 16, 2010 11:32 am
by Ceprotec
Sergey Tkachenko Hi!
My name is Vinicius and I'm working at the company Ceprotec. Recently who was talking to you was William, now on I will.

Well, I'm having a problem in RichView because I use variables that are locked into the text without being able to change them, for example, without permission to enter space. As is recorded in a database it stores everything in text form and returns the data when the variables also return in the form of text and no longer blocked. How do I return the data when the variables back in text form?

example, the variable {name} is inserted without modification and returns when you can change it.

I'm waiting. If you want you can reply by email: desenvolvimento.ceprotec @ gmail.com
Even more. Hug.

Posted: Tue Nov 16, 2010 1:02 pm
by Sergey Tkachenko
Do you want, after loading, search for all variables inside {} and apply a protected text style to them?

Posted: Tue Nov 16, 2010 3:41 pm
by Ceprotec
Hi!
That's right I need, when it loads the text in TRichView, fields that are variable and not need sheltered back in plain text.

To enter variables I use:

SRichViewEdit1.RichViewEdit.CurTextStyleNo: = 6;
SRichViewEdit1.RichViewEdit.InsertText ('{name}', False);
SRichViewEdit1.RichViewEdit.SetFocus;

So he enters the protected variable alterations, but when it reloads it comes in plain text. How would I go for when it loads, the text name} {return protected, would have to use another command instead of InsertText?

Posted: Tue Nov 16, 2010 4:37 pm
by Sergey Tkachenko
Did I understand correctly: documents are stored in plain text?
Or are they stored in RTF or RVF?

Posted: Tue Nov 16, 2010 5:41 pm
by Ceprotec
Documents are stored in a table in the database in a variable of type 'image', and are recorded in 'Binary'.

Posted: Wed Nov 17, 2010 9:39 am
by Sergey Tkachenko
Ok, this is a field format. But what's is the format of document itself?
If you use TDBRichViewEdit, what's the value of FieldFormat property?

Why I ask.

If you save document in RVF format, all protection must be saved and loaded, unless there is some property settings preventing a correct work with styles. In this case, we need to change some properties to fix it.

If you save document in RTF format, all formatting must be stored, but protection is lost. In this case, we can write a procedure that will search for all fields inside {} and apply a protected style to them.

If you save document in a plain text format, all formatting, tables, images, protection are lost. We can create the same procedure as for RTF, but the simplest way is to implement a custom loading procedure that will search for fields before adding text to TRichView.

Posted: Wed Nov 17, 2010 10:39 am
by Ceprotec
I'm using SRichViewEdit if I use a DBSRichViewEdit the FieldFormat is rvdbRVF. If I use this DBSRichViewEdit can solve the problem?
Send me the procedure that will search all fields in {} protected and apply a style to them so I try and see if it resolves.

Posted: Wed Nov 17, 2010 1:01 pm
by Ceprotec
I'm writing this:

var Stream: TStream;

Stream: = Table1.CreateBlobStream (Table1MODELO, bmWrite);
SRichViewEdit1.RichViewEdit.SaveRTFToStream (Stream, False);
Stream.Free;

Could change anything in that code to solve?

Posted: Wed Nov 17, 2010 5:11 pm
by Sergey Tkachenko
If you can use RVF (native TRichView format) instead of RTF (rich text format), protection will be stored automatically.
Change SaveRTFToStream to SaveRVFToStream.

But if using RTF is important, I can create a procedure for applying protection to text inside {}.

Posted: Wed Nov 17, 2010 5:44 pm
by Ceprotec
I changed to SaveRTFToStream SaveRVFToStream and really worked, but if I select only a few characters into the variable and put in bold or italics, etc. .. it loses the variable. Its to do that when we click on the variable on top of it to select it all, oh this problem would be resolved.

Thanks in advance.

Posted: Thu Nov 18, 2010 12:27 pm
by Sergey Tkachenko
Which protection options did you include in the style for variables (6th)?
It is possible to protect variables from changing their text style.

For example, if you include rvprStyleSplitProtect, text style will be changed for the whole variable.
rvprModifyProtect must protect it from changing text style for a part of variable (because it means modification).
rvprStyleProtect must protect from any change of text styles (if you implement OnStyleConversion yourself, you need to check this option manually)

Posted: Thu Nov 18, 2010 6:41 pm
by Ceprotec
Thank you, I changed those components and it worked.
I'm having a more difficult: to insert the text box, or squares, circles ... ACTION did not find any that do it, mainly because the text box takes a lot of this tool. What should I do?

Even more.

Posted: Sun Nov 21, 2010 9:13 pm
by Sergey Tkachenko
TRichView/ScaleRichView does not support free positioning of objects. Objects can be either inserted in line like a character, or aligned to the left/right side. Because of this, text boxes are not supported (if you tell about "text box" as a text inside a frame that can be positioned at the specified coordinates).
Shapes (square, circle, etc.) are not supported too. You can either insert them as an image (metafile), or insert TSRVPaintBox where you can draw a shape yourself.

Posted: Tue Nov 23, 2010 12:21 pm
by Ceprotec
Ok. So far it was. Thanks!

Posted: Wed Jun 27, 2012 6:44 pm
by Bjoern
Hello,
Sergey Tkachenko wrote: But if using RTF is important, I can create a procedure for applying protection to text inside {}.
did you ever wrote that procedure? ... because i have the same problem :-)
TDBRichViewEdit with saving as RTF in the Database (because of RTF2HTML-converting later) and i must insert and protect parts of text in the TDBRichViewEdit (javascripts from a generator)

Greetings
Björn