Hi all,
I'm evaluating this software and have come accross an issue:
RichViewEdit.LoadRVFFromStream Fails (returns false)
I basically loaded the RichViewActions Demo into a project, completely unchanged. I added a procedure called StartUp tha happens after formCreate but before formShow
I also made sure that the RichViewEdit1's rvfoSaveTextStyles, rvfoSaveParaStyles are true
Here's the code:
procedure TFormRVF_FieldEdit.Startup(Sender: TObject;var zCurrent:WideString);
var zStream:TStringStream;
begin
if zCurrent<>'' then
begin
zResult_RVF:=zCurrent;
zStream:=TStringStream.Create(zCurrent);
zStream.Position := 0;
RichViewEdit1.Clear;
if not RichViewEdit1.LoadRVFFromStream(zStream) then
ShowMessage('load failed');//it always fails
RichViewEdit1.Format;
zStream.Free;
end;
Anything, I need to add, or is there some setting in the RichViewActions Demo theat would prevent loadinf rvf from a stream?
RichViewEdit.LoadRVFFromStream Fails (returns false)
-
- Posts: 57
- Joined: Wed Aug 31, 2005 6:46 pm
Re: RichViewEdit.LoadRVFFromStream Fails (returns false)
What is zCurrent?mgkrebbs wrote:Hi all,
if zCurrent<>'' then
begin
zResult_RVF:=zCurrent;
zStream:=TStringStream.Create(zCurrent);
zStream.Position := 0;
RichViewEdit1.Clear;
if not RichViewEdit1.LoadRVFFromStream(zStream) then
ShowMessage('load failed');//it always fails
RichViewEdit1.Format;
zStream.Free;
end;
Does it start with "-8 1", etc. ?
See RVF Specification in help
Good question.
I created the file in the exact same RichView Edit, so I don't know why the load from stream fails. Loading it from file works, and the stream's text looks exactly like the file does when I view it in Notepad.
Here's the value of zCurrent from the debugger:
'-8 1 3'#$D#$A'-7 0 -1 0 0 0 0 536870911'#$D#$A'-9 2 0 0 2 0 1'#$D#$A'RVStyle1'#$D#$A'î'#2#0#0'-9 2 0 0 2 0 2'#$D#$A'RVStyle1'#$D#$A'K'#0#0#0'-9 2 0 0 2 0 4'#$D#$A'RVStyle1'#$D#$A'—'#8#0#0'-9 2 0 0 2 0 3'#$D#$A#$D#$A'!'#0#0#0#0#0#0#0#$19#0#0#0#5#0#0#0#5#0#0#0#5#0#0#0#5#0#0#0#0#0#0#0#0#0#0#0#0'0 1 0 0 0 0'#$D#$A'This is a '#$D#$A'1 1 -1 1 0 0'#$D#$A'test.'#$D#$A'0 1 -1 1 0 0'#$D#$A' '#$D#$A'2 1 -1 1 0 0'#$D#$A'Should be underlined.'#$D#$A'0 1 -1 1 0 0'#$D#$A' '#$D#$A'3 1 -1 1 0 0'#$D#$A'This sentence only is in Times New Roman.'#$D#$A'0 1 -1 1 0 0'#$D#$A' This in Arial. '#$D#$A'4 1 -1 1 0 0'#$D#$A'This is 12-point.'#$D#$A'0 1 -1 1 0 0'#$D#$A' Please visit '#$D#$A'5 1 -1 1 0 "http://www.msn.com"'#$D#$A'MSN'#$D#$A'0 1 -1 1 0 0'#$D#$A' to read some stuff.'#$D#$A'-11 0 0 0 0 0 0 0 1 0'#$D#$A'0 1 -1 1 0 0'#$D#$A'Bullet 1'#$D#$A'-11 0 0 0 0 0 0 0 1 0'#$D#$A'0 1 -1 1 0 0'#$D#$A'Bullet 2'#$D#$A'-11 0 0 0 0 0 1 0 1 0'#$D#$A'0 1 -1 1 0 0'#$D#$A'Item 1'#$D#$A'-11 0 0 0 0 0 1 0 1 0'#$D#$A'0 1 -1 1 0 0'#$D#$A'Item 2'#$D#$A'0 2 1 0 0 0'#$D#$A'This paragraph has been indented.'#$D#$A'It sure has.'#$D#$A'0 1 0 0 0 0'#$D#$A'OK, back to normal.'#$D#$A'7 1 0 0 0 0'#$D#$A'Strikeout!!!!!'#$D#$A'0 1 0 0 0 0'#$D#$A#$D#$A
I created the file in the exact same RichView Edit, so I don't know why the load from stream fails. Loading it from file works, and the stream's text looks exactly like the file does when I view it in Notepad.
Here's the value of zCurrent from the debugger:
'-8 1 3'#$D#$A'-7 0 -1 0 0 0 0 536870911'#$D#$A'-9 2 0 0 2 0 1'#$D#$A'RVStyle1'#$D#$A'î'#2#0#0'-9 2 0 0 2 0 2'#$D#$A'RVStyle1'#$D#$A'K'#0#0#0'-9 2 0 0 2 0 4'#$D#$A'RVStyle1'#$D#$A'—'#8#0#0'-9 2 0 0 2 0 3'#$D#$A#$D#$A'!'#0#0#0#0#0#0#0#$19#0#0#0#5#0#0#0#5#0#0#0#5#0#0#0#5#0#0#0#0#0#0#0#0#0#0#0#0'0 1 0 0 0 0'#$D#$A'This is a '#$D#$A'1 1 -1 1 0 0'#$D#$A'test.'#$D#$A'0 1 -1 1 0 0'#$D#$A' '#$D#$A'2 1 -1 1 0 0'#$D#$A'Should be underlined.'#$D#$A'0 1 -1 1 0 0'#$D#$A' '#$D#$A'3 1 -1 1 0 0'#$D#$A'This sentence only is in Times New Roman.'#$D#$A'0 1 -1 1 0 0'#$D#$A' This in Arial. '#$D#$A'4 1 -1 1 0 0'#$D#$A'This is 12-point.'#$D#$A'0 1 -1 1 0 0'#$D#$A' Please visit '#$D#$A'5 1 -1 1 0 "http://www.msn.com"'#$D#$A'MSN'#$D#$A'0 1 -1 1 0 0'#$D#$A' to read some stuff.'#$D#$A'-11 0 0 0 0 0 0 0 1 0'#$D#$A'0 1 -1 1 0 0'#$D#$A'Bullet 1'#$D#$A'-11 0 0 0 0 0 0 0 1 0'#$D#$A'0 1 -1 1 0 0'#$D#$A'Bullet 2'#$D#$A'-11 0 0 0 0 0 1 0 1 0'#$D#$A'0 1 -1 1 0 0'#$D#$A'Item 1'#$D#$A'-11 0 0 0 0 0 1 0 1 0'#$D#$A'0 1 -1 1 0 0'#$D#$A'Item 2'#$D#$A'0 2 1 0 0 0'#$D#$A'This paragraph has been indented.'#$D#$A'It sure has.'#$D#$A'0 1 0 0 0 0'#$D#$A'OK, back to normal.'#$D#$A'7 1 0 0 0 0'#$D#$A'Strikeout!!!!!'#$D#$A'0 1 0 0 0 0'#$D#$A#$D#$A
-
- Posts: 57
- Joined: Wed Aug 31, 2005 6:46 pm
That's right.mgkrebbs wrote:I figured out the the problem is in passing it through a TStringStream or a WideString. I loaded it directly to and from a TMemoryStream , and it works fine. If I figure out which one it was, I'll post here. Thanks to everyone for your suggestions.
RVF is a binary format, not text format, so using TMemoryStream (not TStringStream) will be correct.
-
- Site Admin
- Posts: 17566
- Joined: Sat Aug 27, 2005 10:28 am
- Contact: