Hi,
I want to use RichView as a very basic template editor like this:
1. I automatically load an .html (template) document when the editor starts up. This is a simple .html document containing a table with two places (cells) for text entry (one is multi-line) as well as 3 image place holders (each in own cell).
2. I only want the user to be able to replace the text and images, without the table resizing.
My questions are:
1. Is there a way to lock everything in the editor, except for the text and image cells?
2. Is there a way to automatically resize an image in a cell when the user inserts it? I want the user to be able to load .jpeg, .gif, .wmf and .bmp images.
3. Can I force the table cells to remain their original size as the template should always be the exact same size.
Hope this makes sense.
TIA,
Shaune
Very basic template editor
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
You can add some protection to documents, but this protection cannot be stored/loaded in HTML format.
The only format that can store protection options is RVF (RichView Format).
1) How to protect the table from deletion
One of solutions - include rvpaoReadOnly and rvpaoDoNotWantReturns in the Options properties of the paragraph style used for this table
(if this document is generated by Add*** methods, the code for adding table would be)
This protection does not allow to delete table or to insert something before and after it (if the document contains only this table).
2) How to protect table from resizing
Exclude rvtoRowSizing and rvtoColSizing from table.Options, and users will not be able to resize it with mouse.
Also, you may consider adding rvtoIgnoreContentWidth, rvtoIgnoreContentHeight in table.Options. In this case, table size will be calculated only using Cell.BestWidth and Cell.BestHeight, width and height of cells content will be inored (clipped).
3) How to protect cells with images
Probably, the simplest way is to do it like for the table - including rvpaoReadOnly and rvpaoDoNotWantReturns in the paragraph options for the images. Remove the protection just before calling SetCurrentPictureInfo, and restore after the call.
As I understand, you need to prevent user from adding line breaks, so instead of rvpaoDoNotWantReturns in paragraph options, you can simply add rvoDoNotWantReturns in RichViewEdit.EditorOptions.
4) Resizing pictures.
When generating the template, you can resize the picture:
You'll modify pictures using the SetCurrentPictureInfo method, it does not change rvepImageWidth and rvepImageHeight properties, so images will be of the same size.
4) How to protect text
As for preventing Return keys, see before.
How to prevent inserting non-text content, see here:
http://www.trichview.com/forums/viewtopic.php?t=22
The only format that can store protection options is RVF (RichView Format).
1) How to protect the table from deletion
One of solutions - include rvpaoReadOnly and rvpaoDoNotWantReturns in the Options properties of the paragraph style used for this table
(if this document is generated by Add*** methods, the code for adding table would be
Code: Select all
table.ParaNo := <index of the protected paragraph style>;
rve.AddItem('', table);
This protection does not allow to delete table or to insert something before and after it (if the document contains only this table).
2) How to protect table from resizing
Exclude rvtoRowSizing and rvtoColSizing from table.Options, and users will not be able to resize it with mouse.
Also, you may consider adding rvtoIgnoreContentWidth, rvtoIgnoreContentHeight in table.Options. In this case, table size will be calculated only using Cell.BestWidth and Cell.BestHeight, width and height of cells content will be inored (clipped).
3) How to protect cells with images
Probably, the simplest way is to do it like for the table - including rvpaoReadOnly and rvpaoDoNotWantReturns in the paragraph options for the images. Remove the protection just before calling SetCurrentPictureInfo, and restore after the call.
As I understand, you need to prevent user from adding line breaks, so instead of rvpaoDoNotWantReturns in paragraph options, you can simply add rvoDoNotWantReturns in RichViewEdit.EditorOptions.
4) Resizing pictures.
When generating the template, you can resize the picture:
Code: Select all
cell.AddPictureEx(...);
cell.SetItemExtraIntProperty(cell.ItemCount-1, rvepImageWidth, 100);
cell.SetItemExtraIntProperty(cell.ItemCount-1, rvepImageHeight, 100);
4) How to protect text
As for preventing Return keys, see before.
How to prevent inserting non-text content, see here:
http://www.trichview.com/forums/viewtopic.php?t=22