Page 1 of 2

Insert Control at beginning and end of a paragraph

Posted: Tue Mar 01, 2011 1:13 pm
by Jam_Dave
Hi,
I'm evaluating your control for a projekt and I have a question.
How can I insert a control at a specific position?
I want to add a control before and after every paragraph.

Thanks for your help.

Best regards
Jam_Dave

Posted: Tue Mar 01, 2011 3:49 pm
by Sergey Tkachenko
Can you explain the problem with more details?
Should it be an editing operation (can be undone by the user) or not?

Posted: Wed Mar 02, 2011 8:48 am
by Jam_Dave
I'm making a Html-Editor.
I want to show the user how many paragraphs he made and wich element is in a paragraph.

I've found a sample.
Like this:
http://img19.imageshack.us/i/unbenanntua.png/

Posted: Wed Mar 02, 2011 2:26 pm
by Jam_Dave
Is there a fast way to show those "paragraph signs"?

I've made it by iterating over the whole Document. But the "signs" are handled by the Component as Element, not only as View.

Is there a way to get the Cursor position at the current Text-Item?

Last question, do i have influence to the html parser?
I want to get Fonts etc. by <p> tags.
I've tried inlineCSS, but it's over bloated...

Thanks for your help

Posted: Wed Mar 02, 2011 5:34 pm
by Sergey Tkachenko
For drawing paragraph marks, include rvoShowSpecialCharacters in RichViewEdit.Options, and call RichViewEdit.Reformat.
This option shows not only end-of-paragraph marks, but some other hidden information, you can customize it using RVVisibleSpecialCharacters global variable.
You can define font color for these marks as RichViewEdit.Style.SpecialCharactersColor

Posted: Wed Mar 02, 2011 5:36 pm
by Sergey Tkachenko
The caret position in the current text item is returned by OffsetInCurItem property (the caret is inside RichViewEdit.TopLevelEditor.CurItemNo, at the position RichViewEdit.TopLevelEditor.OffsetInCurItem).

If you need a position in a line, use GetCurrentLineCol method.

Posted: Wed Mar 02, 2011 5:37 pm
by Sergey Tkachenko
About the influence to the html parser.
Do you want to modify saving or loading HTML?
And how?

Posted: Thu Mar 03, 2011 9:17 am
by Jam_Dave
Is there any way to show a mark at the beginning of a paragraph?
If not, is it possible to make it with small changes in the source of the component?

I want to modify the saving function.
The paragraphs should be saved in <p> tags like using inlineCss
but without those "unused" attributs like
padding: 0px 0px 0px 0px;

Example:
TRichView without Css:

Code: Select all

<font size=2 color="#000000" face="Arial">
<div>test</div>
With Css:

Code: Select all

<p style=" text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;"><span style=" font-size: 10pt; font-family: 'Arial', 'Helvetica', sans-serif; font-style: normal; font-weight: normal; color: #000000; background-color: transparent; text-decoration: none;">test</span></p>
I want it like this:

Code: Select all

<p><font size="2" face="Arial">test</font></p>

Posted: Thu Mar 03, 2011 10:32 am
by Sergey Tkachenko
Ok, in the next update, there will be a compiler define activating drawing marks at the beginning of paragraphs: RVDRAWPARAMARKSBEFORE.

Posted: Thu Mar 03, 2011 10:34 am
by Sergey Tkachenko
I do not think the these CSS options are completely unused.
For example, by default, paragraphs have non-zero spacebefore and spaceafter, so zero indents are necessary.
Browser default colors can be customized as well.

Posted: Thu Mar 03, 2011 12:52 pm
by Jam_Dave
hmm.. ok.. thats right.
But is there a way to modify it?

We are really interested in using your component in our product SmartSerialMail.
But there is a problem with the Html.
I'm using RvHtmlImporter in my testproject.
If i use the html export of TRichView and import the source again with RvHtmlImporter, the view is sometimes different.

Is there a better way to load HTML?

Posted: Thu Mar 03, 2011 1:31 pm
by Sergey Tkachenko
TrvHtmlImporter does not understand CSS (it can load CSS saved by TRichView, but not an inline version).
TrvHtmlViewImporter provides much better results.

Posted: Thu Mar 03, 2011 2:02 pm
by Jam_Dave
Is there a Version for Delphi 2010?
On http://www.trichview.de/resources the last one is for Delphi 2009

Posted: Thu Mar 03, 2011 2:43 pm
by Sergey Tkachenko
http://www.songbeamer.com/delphi/ - can be installed in Delphi 2010, but a package must be created.

(There is also version from http://code.google.com/p/thtmlviewer/ . Some changes are required in TRvHtmlViewImporter to support it, these changes will be made in the next update.)

Posted: Fri Mar 04, 2011 11:26 am
by Jam_Dave
The TrvHtmlViewImporter has trouble with tables.
I cant use it like that.

Do you know any good Html to RTF Converter or can you tell me how i can parse the source without loss?
I need it for WYSIWYG and if there are changes in the View from parsing to html and loading back, i cant use this Component.