Hi Sergey,
I am currently doing the following process to load a 2 column table for printing (RV3,Table1) from a subset of the entries in another table (RV1,Table1):
RV1,Table1,Cell[i,j] SaveRVFToStream
RV2 LoadRVFFromStream
RV2 SaveRVFToStream
RV3,Table1,Cell[k,l]AppendRVFFromStream
This works fine and all the formatting present in RV1,Table1 appears correctly in RV3,Table1 EXCEPT the BiDiMode setting of RV2. I cannot set the entire RV3 to a specific BiDiMode because one column of RV3,Table1 may need to be RTL while the other may need to be LTR.
What is the best way to iterate through the text items (paragraphs?) of each cell in RV3,Table1, Column1 so that it will have BiDiMode = rvbdRightToLeft?
This operation does not need to be user-reversible, since it is simply setting up a specific table organization for the printing of the data. The data in RV3 is not saved after it is used - the master data is the data in RV1.
A code example would be great!
Thanks In Advance,
Dick
How To Conditionally Apply BiDiMode Settings?
-
- Posts: 148
- Joined: Wed Dec 07, 2005 2:02 pm
- Contact:
-
- Site Admin
- Posts: 17569
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Code: Select all
// Returns index of paragraph style in rvs having all properties
// of the ParaNo-th style, but the specified BiDiMode
function GetParaNo(rvs: TRVStyle; ParaNo: Integer; BiDiMode: TRVBiDiMode): Integer;
var ParaStyle: TParaInfo;
begin
ParaStyle := TParaInfo.Create(nil);
ParaStyle.Assign(rvs.ParaStyles[ParaNo]);
ParaStyle.BiDiMode := BiDiMode;
Result := rvs.ParaStyles.FindSuchStyle(ParaNo, ParaStyle, RVAllParaInfoProperties);
if Result<0 then begin
rvs.ParaStyles.Add;
Result := rvs.ParaStyles.Count-1;
rvs.ParaStyles[Result].Assign(ParaStyle);
rvs.ParaStyles[Result].Standard := False;
end;
end;
// Changing BiDiMode for all paragraphs in RVData.
// If RVData has nested tables, it DOES NOT change BiDiMode of items
// in them.
procedure ChangeParasBiDi(RVData: TCustomRVData; BiDiMode: TRVBiDiMode);
var OldParaNo, NewParaNo, i: Integer;
begin
OldParaNo := -1;
NewParaNo := -1;
for i := 0 to RVData.ItemCount-1 do begin
if RVData.GetItem(i).ParaNo<>OldParaNo then begin
OldParaNo := RVData.GetItem(i).ParaNo;
NewParaNo :=GetParaNo(RVData.GetRVStyle, OldParaNo, BiDiMode);
end;
RVData.GetItem(i).ParaNo := NewParaNo
end;
end;
// Example
ChangeParasBiDi(table.Cells[0,0].GetRVData, rvbdRightToLeft);
-
- Posts: 148
- Joined: Wed Dec 07, 2005 2:02 pm
- Contact: