Insert Control at beginning and end of a paragraph

General TRichView support forum. Please post your questions here
Jam_Dave
Posts: 9
Joined: Tue Mar 01, 2011 1:08 pm

Insert Control at beginning and end of a paragraph

Post 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
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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?
Jam_Dave
Posts: 9
Joined: Tue Mar 01, 2011 1:08 pm

Post 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/
Jam_Dave
Posts: 9
Joined: Tue Mar 01, 2011 1:08 pm

Post 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
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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.
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

About the influence to the html parser.
Do you want to modify saving or loading HTML?
And how?
Jam_Dave
Posts: 9
Joined: Tue Mar 01, 2011 1:08 pm

Post 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>
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Ok, in the next update, there will be a compiler define activating drawing marks at the beginning of paragraphs: RVDRAWPARAMARKSBEFORE.
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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.
Jam_Dave
Posts: 9
Joined: Tue Mar 01, 2011 1:08 pm

Post 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?
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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.
Jam_Dave
Posts: 9
Joined: Tue Mar 01, 2011 1:08 pm

Post by Jam_Dave »

Is there a Version for Delphi 2010?
On http://www.trichview.de/resources the last one is for Delphi 2009
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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.)
Jam_Dave
Posts: 9
Joined: Tue Mar 01, 2011 1:08 pm

Post 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.
Post Reply