RichView extension usage

zhaozj2021-02-16  99

Get Character Count Count The Paragraphsave Rvprint's Margins in RvfWord Wrapping

Q: isn't there, isn't there, a: the function below returns a Number of Characters: Uses CRVDATA, RVTABLE DIVABLE

Function GetCharcount (RVData: TCUSTOMRVDATA): Integer; Var i, r, c: integer; table: trvtableIteminfo; begin result: = 0; for i: = 0 to rvdata.items.count-1 do if rvdata.getItemStyle (i) > = 0 THEN INC (RVData.Itemley ") Else if Rvdata.getItemStyle (i) = rvstable the beginning: = trvtableiteminfo (RVData.getItem (i)); for r: = 0 to Table.Rows. Count-1 do for c: = 0 to Table.Rows [R] .count-1 do if Table.cells [r, c] <> nil dam (result, getcharcount (Table.cells [r, c] .getrvdata End;

Call: getcharcount (richviewedit1.rvdata);

THIS FUNCTION DOES NOT INCLUDE INTURT: - NON-TEXT ITEMS, SUCH AS IMAGES - Carriage Returns

Q: How do I count the paragraph in rve? A: if you want to count paragraphs not inclished Table Cell (Table Are Cell), The code iscnt: = 0; for i: = 0 to rv.Itemcount-1 DO if rv.isparastart (i) THEN INC (CNT);

? Q: How to save RVPrint's margins in RVF files (not RTF) A: 1) Include rvfoSaveDocProperties and rvfoLoadDocProperties in RichViewEdit1.RVFOptions2) Write two procedures for saving and loading margins in RichViewEdit1.DocProperties: procedure TForm3.DocPropToRVPrint; var s: String ; begin s: = RichViewEdit1.DocProperties.Values ​​[ 'LeftMarginMM']; RVPrint1.LeftMarginMM: = StrToIntDef (s, 20); s: = RichViewEdit1.DocProperties.Values ​​[ 'TopMarginMM']; RVPrint1.TopMarginMM: = StrToIntDef (s , 20); s: = RichViewEdit1.DocProperties.Values ​​[ 'RightMarginMM']; RVPrint1.RightMarginMM: = StrToIntDef (s, 20); s: = RichViewEdit1.DocProperties.Values ​​[ 'BottomMarginMM']; RVPrint1.BottomMarginMM: = StrToIntDef (s, 20); end; procedure TForm3.RVPrintToDocProp; begin RichViewEdit1.DocProperties.Clear; RichViewEdit1.DocProperties.Add ( 'LeftMarginMM =' IntToStr (RVPrint1.LeftMarginMM)); RichViewEdit1.DocProperties.Add ( 'TopMarginMM =' INTSTOSTR (RVPrint1.topmarginmm);

Richviewedit1.docproperties.add ('Right Marginmm =' INTOSTR (RVPrint1.right Marginmm);

Richviewedit1.docproperties.add ('bottommarginmm =' intent "); end;

3) Process rvActionPageSetup.OnExecute.First call default Execure (showing dialog), then save changes in RIchViewEdit1.DocProperties: procedure TForm3.rvActionPageSetupExecute (Sender: TObject); begin (Sender as TrvActionPageSetup) .OnExecute: = nil; (Sender as TrvActionPageSetup ) .Execute; (Sender as TrvActionPageSetup) .OnExecute: = rvActionPageSetupExecute; RichViewEdit1.Change; RVPrintToDocProp; end; 4) Process rvActionSave.OnDocumentFileChange (this event is already processed in the ActionTest demo) Add the code reading margins to RVPrint from DocProperties. procedure TForm3.rvActionSave1DocumentFileChange (Sender: TObject; Editor: TCustomRichViewEdit; const FileName: String; FileFormat: TrvFileSaveFilter; IsNew: Boolean); begin .... DocPropToRVPrint; end; Q: Word Wrapping A: By default, wrapping border is equal. To The Width of Window. But If The Document Contains Wide Items (Wide Pictures, Tables, No-Wrap Paragraphs), Wrapping Border Is Equal to The Width of The Widest Item. in Short, Wrapping B order is equal to the width of horizontal scrolling area.If you set MaxTextWidth to nonzero, it defines a wrapping border, regardless of width of window or width of widest item.If you set rvoClientTextWidth in Options, wrapping border is always equal to the width Of Window, Even IFTWIDTH Defines A Minimal Width of Horizontal Scrolling Area.

A script below here: