how can i update all images in the content to stay in its own line? for example, this is my content:
abc[picture]xyz
i want it to be:
abc
[picture]
xyz
update all image
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Assuming that this operation do not need to be undone:
Code: Select all
uses RVTable, CRVData;
procedure MoveImagesToNewLine(RVData:TCustomRVData);
var i,r,c: Integer;
Table: TRVTableItemInfo;
begin
for i := 0 to RVData.ItemCount-1 do
case RVData.GetItemStyle(i) of
rvsPicture, rvsHotPicture:
begin
if (i>0) and (RVData.GetItemStyle(i-1)<>rvsListMarker) then
RVData.GetItem(i).SameAsPrev := False;
if i+1<RVData.ItemCount then
RVData.GetItem(i+1).SameAsPrev := False;
end;
rvsTable:
begin
Table := TRVTableItemInfo(RVData.GetItem(i));
for r := 0 to Table.RowCount-1 do
for c := 0 to Table.ColCount-1 do
if Table.Cells[r,c]<>nil then
MoveImagesToNewLine(Table.Cells[r,c].GetRVData);
end;
end;
end;
procedure TForm3.ToolButton68Click(Sender: TObject);
begin
RichViewEdit1.ClearUndo;
MoveImagesToNewLine(RichViewEdit1.RVData);
RichViewEdit1.Format;
end;
it works, but i need one more changes to the image para which is alignment will be changed to rvaCenter.Sergey Tkachenko wrote:Assuming that this operation do not need to be undone:
Code: Select all
uses RVTable, CRVData; procedure MoveImagesToNewLine(RVData:TCustomRVData); var i,r,c: Integer; Table: TRVTableItemInfo; begin for i := 0 to RVData.ItemCount-1 do case RVData.GetItemStyle(i) of rvsPicture, rvsHotPicture: begin if (i>0) and (RVData.GetItemStyle(i-1)<>rvsListMarker) then RVData.GetItem(i).SameAsPrev := False; if i+1<RVData.ItemCount then RVData.GetItem(i+1).SameAsPrev := False; end; rvsTable: begin Table := TRVTableItemInfo(RVData.GetItem(i)); for r := 0 to Table.RowCount-1 do for c := 0 to Table.ColCount-1 do if Table.Cells[r,c]<>nil then MoveImagesToNewLine(Table.Cells[r,c].GetRVData); end; end; end; procedure TForm3.ToolButton68Click(Sender: TObject); begin RichViewEdit1.ClearUndo; MoveImagesToNewLine(RichViewEdit1.RVData); RichViewEdit1.Format; end;
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
now the picture is on para of its own right? i want the picture to be aligned to center. there will no other things are allowed in the same para with the pictureSergey Tkachenko wrote:Do you want to keep all other paragraph properties (such as indents or background) and simple make this paragraph centered?
Or may be you want to apply some specific paragraph style (centered, no indents, no background color, etc.)