table width and height: can NOt figure. Help

General TRichView support forum. Please post your questions here
Post Reply
alogrep
Posts: 52
Joined: Fri Oct 27, 2006 5:25 pm

table width and height: can NOt figure. Help

Post by alogrep »

Hi Sergey
I am creating a table
with TRVTableItemInfo.CreateEx(r,9, RichViewEdit1.RVData)
I have ONE Parastyle in my RichEdit1 Styles, and options is [rvpaoNoWrap].
To make sure, before I assign the width/height to the table I do
RichViewEdit1.CurParaStyleNo:=0;
Then I do
for r := 0 to table.Rows.Count-1 do begin
for c := 0 to table.Rows[r].Count-1 do begin
table.Cells[r,c].bestWidth := 50;
table.Cells[r,c].BestHeight:=22;
Well, first the Height seems a devilish trick. The smaller the number the higher the cells become (like 3 or 4 times the needed height).
As to the width, no it does not expand, but the text inside the cells wrap.
How can I make sure the cell expand as need, and are short as i want them to be? Is the font size being used in CurTextStyleNo a factor?
However the font is Arial 8, and I do not see why the text wraps instead of making the cell wider, when i tell it NO TO wrap by setting options to [rvpaoNoWrap]. . And I can't understand why the cella are so so so tall. Any help?
Thanks
Enrico
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Please send me a simple project demonstrating the problems.
alogrep
Posts: 52
Joined: Fri Oct 27, 2006 5:25 pm

Post by alogrep »

Sorry
I can't make a small test project, because I have modified the actions file and they require a lot of other files including dta modlules.
However, I found out this:
1. The best width did not work, because I create the table first, then I
call the editor, and at this moment I load a template file from disk. This loading changes all the Parastyles. i.e. I had a Parastyles[0] with [noWrap]
ad design time, but when I load the file this is canged to []. Why?
I do not want that, can I stop this from happening? The worst is that even if i create a new parastyle, that too is 'cleared' (or changed) when I load the file. How can I stop this from happening? If not, how canI know and tell what of ALL (many!) properties a given parastyle has?
2. The height simply does nothing. I can set cells[x,y].Bestheight to any thing, the actual height (too high) never changes.
What can affect this? What property in the Parastyle (or in textstyle?)
Thanks.
Enrico
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

If you do not want to load collections of paragraph and list styles from RVF, set RVFParaStylesReadMode=rvf_sIgnore.
For text styles, set RVFTextStylesReadMode to the same value.
If you do not want to save styles in RVF file, exclude rvfoSaveParaStyles and rvfoSaveTextStyles from RVFOptions.

As for row height, it is equal to the height of the tallest cell in it.
In normal mode, BestHeight allows to make cell taller, but cell height cannot be less than necessary to show its content.
If you do not want to take cell content into account, include rvtoIgnoreContentHeight in table.Options.
alogrep
Posts: 52
Joined: Fri Oct 27, 2006 5:25 pm

Post by alogrep »

Sergey
I did what you suggested (set No save and No load styles ).
But that makes me loose the page. In other words, I have a page with text and fields in it. When I save it and then reload it, the page is blank.
(Sometimes it shows only a wordor so).
If I have the Save and Load styles set, then I can save and load and what I saved shows on the page. I load with LoadRVFFromField (since i save to a blob field).
What I really want to do is this: after I save a page, and then I reload it, I want to see the page EXACTLY as I saved it. But I want
my ParaStyle[0] to be ALWAYS AS it is ad design time. E.g. if i change
font size form 10 to 8 in the design, the next time I open the editor
I want the size to remain 8, not changed to 10 or whatever when
I LoadRVFFromField. Is this possible? (i.e. the style info saved in the file or field so the page can dispaly, but the styles in the object inspector left intact no matter how many times i do LoadRVFFromField with different fields?)
Thanks
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

LoadRVFFromStream can either load styles (existing styles are replaced) or ignore styles (so collections of styles at the moment of loading must be the same as at the moment of saving, otherwise document cannot be loaded).

I hope the following setting will work as you need:
1) Return back saving and loading styles
2) Instead of using rv.LoadRVFFromStream, use

Code: Select all

rv.Clear;
rv.DeleteUnusedStyles(True, True, True);
rv.InsertRVFFromStream(Stream, 0);
Unlike LoadRVFFromStream, InsertRVFFromStream adds required styles from RVF without replacing existing styles.
DeleteUnusedStyles does not delete styles having Standard property = True (default value).
Post Reply