How to set paragraph style for bullet & numbering list?
How to set paragraph style for bullet & numbering list?
How can I assign a paragraph style to a bullet list or numbered list?
Or: how can I change the space before, space after, line spacing for such a list?
Or: how can I change the space before, space after, line spacing for such a list?
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
So sorry, I assume a node in my thinking ...
I have an editor with a predefindes set of styles - normal, bold, italic, underline, strikeout. That's it.
For the one an only ParaStyle I defined 'SpaceBefor' 10px.
But I need another predefined style for the bullets without SpaceBefore, a second one that I can connect to the ListStyles. In other words: how does the editor know which style to take for the bullet list? If I define a second one then he makes a third but the bullets have 10px SpaceBefore ... I am really desperate, don't understand relations.
Would be happy for solution!
Thanks
Martin
I have an editor with a predefindes set of styles - normal, bold, italic, underline, strikeout. That's it.
For the one an only ParaStyle I defined 'SpaceBefor' 10px.
But I need another predefined style for the bullets without SpaceBefore, a second one that I can connect to the ListStyles. In other words: how does the editor know which style to take for the bullet list? If I define a second one then he makes a third but the bullets have 10px SpaceBefore ... I am really desperate, don't understand relations.
Would be happy for solution!
Thanks
Martin
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Paragraph styles and list styles are applied separately.
Do you need to create list in code?
SetListMarkerInfo has AListNo parameter where you can specify the index in ListStyles, and AParaNo parameter where you can specify the index in ParaStyles.
This code adds a paragraph using ParaStyles[1] and ListStyles[0] to the end of RV:
Do you need to create list in code?
SetListMarkerInfo has AListNo parameter where you can specify the index in ListStyles, and AParaNo parameter where you can specify the index in ParaStyles.
This code adds a paragraph using ParaStyles[1] and ListStyles[0] to the end of RV:
Code: Select all
RV.SetListMarkerInfo(-1, 0{ListNo}, 0, 1, 1{ParaNo}, False);
RV.AddNL(List item', 0);
not completely ...
In the attached ListStyles-Demo you create a bulleted list style with this method:
Afterwards this ListStyle exists and can be used by the RVEdit. In the demo it works fine because the text is not saved an loaded later. My problem is that I cannot allow rvrsAddIfNeeded in RTFReadOptions because I disallow in those RVEdits formatting from outside by dropping text. I need the usage of only predefined styles. So I set the RVEdit to rvrsUseSpecified. But in this case I can save the text but after reloading there are no bullets anymore. I checked out exactly the ListStyles and the according ListLevels and predefined them in the IDE. It doesn't work. What's wrong?
Code for setting / clearing bullets:
This works but in this way I cant protect the edit from formatting
Doesn't work although styles and ListLevels are exactly the same as RVEdit is creating:
In the attached ListStyles-Demo you create a bulleted list style with this method:
Code: Select all
function TForm1.CreateBullets: Integer;
var ListStyle: TRVListInfo;
begin
// 1. Creating desired list style
ListStyle := TRVListInfo.Create(nil);
with ListStyle.Levels.Add do begin
ListType := rvlstBullet;
Font.Name := 'Symbol';
{$IFDEF RICHVIEWCBDEF3}
Font.Charset := SYMBOL_CHARSET;
{$ENDIF}
Font.Size := 12;
FirstIndent := 0;
LeftIndent := 24;
end;
// 2. Searching for existing style with these properties. Creating it, if not found
Result := RVStyle1.ListStyles.FindSuchStyle(ListStyle, True);
ListStyle.Free;
end;
Code for setting / clearing bullets:
Code: Select all
var Item: TCustomRVItemInfo;
begin
if ActiveControl is TRichViewEdit then
begin
if not siHasBullet.Down then
begin
TRichViewEdit(ActiveControl).RemoveLists(False);
Item := TRichViewEdit(ActiveControl).RVData.GetItem(TRichViewEdit(ActiveControl).CurItemNo);
Item.ParaNo := 0;
TRichViewEdit(ActiveControl).Format;
end
else
TRichViewEdit(ActiveControl).ApplyListStyle(CreateBullets, 0, 0, False, False);
end;
end;
Code: Select all
if RVEdit.RTFReadProperties.ParaStyleMode = rvrsAddIfNeeded
Code: Select all
if RVEdit.RTFReadProperties.ParaStyleMode = rvrsUseSpecified
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Unfortunately, bullets and numbering can be read from RTF only if ParaStyleMode = rvrsAddIfNeeded.
In other modes they are ignored.
All modes are supported for bullets and numbering only for RVF.
I do not plan implement mapping to the most similar list for RTF, however, I can implement mapping RTF lists to two predefined list styles (one for numbering, one for bullets)
In other modes they are ignored.
All modes are supported for bullets and numbering only for RVF.
I do not plan implement mapping to the most similar list for RTF, however, I can implement mapping RTF lists to two predefined list styles (one for numbering, one for bullets)
Found a workaround for the meantime:
Not very smart but seems to work:
1. If I press the bullet button during editing the editor creates its new style and saves it to the rtf file
2. For loading a window for self creating of the style that is stored in the file is opened and closes after loading
Code: Select all
rvFDesc.RTFReadProperties.ParaStyleMode := rvrsAddIfNeeded;
try
rvFDesc.LoadRTFFromStream(Stream);
rvFDesc.Format;
finally
rvFDesc.RTFReadProperties.ParaStyleMode := rvrsUseSpecified;
end;
1. If I press the bullet button during editing the editor creates its new style and saves it to the rtf file
2. For loading a window for self creating of the style that is stored in the file is opened and closes after loading