The code I use:
Code: Select all
procedure TForm1.ReplacePlaceHolderItemByATextBox(RVData: TCustomRVData; var ARVE: TRichViewEdit; i: integer {place holder item No});
var
TextBox: TRVTextBoxItemInfo;
id: integer;
begin
TextBox := TRVTextBoxItemInfo.Create(RVData);
TextBox.Document.Clear;
TextBox.Document.AddTextBlockNLA(ListeDesChamps.GetValue(TAG_SignatureCaseACocher),RVData.GetItem(i).StyleNo,RVData.GetItem(i).ParaNo);
// position
TextBox.BoxPosition.HorizontalAnchor := rvhanCharacter;
TextBox.BoxPosition.VerticalAnchor := rvvanLine;
TextBox.BoxPosition.PositionInText := rvpitBelowText;
// size
TextBox.BoxProperties.WidthType := rvbwtAbsolute;
TextBox.BoxProperties.HeightType := rvbhtAbsolute;
TextBox.BoxProperties.Width := 300;
TextBox.BoxProperties.Height := 10;
TextBox.BoxProperties.VAlign := tlBottom;
// removing border and spacing around
TextBox.BoxProperties.Border.Style := rvbNone;//Single;
TextBox.BoxProperties.Border.BorderOffsets.SetAll(0);
TextBox.BoxProperties.Border.Width := 0;
TextBox.BoxProperties.Background.BorderOffsets.SetAll(0);
TextBox.ParaNo := RVData.GetItem(i).ParaNo;
TextBox.BR := False;
TextBox.ClearLeft := False;
TextBox.ClearRight := False;
// adding text box
RVData.AddItem('', TextBox);
id := RVData.Items.IndexOfObject(TextBox);
RVData.Items.Exchange(id , i); // to place my text box at a specific place (instead of my placeholder item)
RVData.DeleteItems(id,1); // I delete my place holder item
ARVE.Format;
end;
Does someone have an idea?