当前位置:网站首页>RichView TRVStyle 模板样式的设置与使用
RichView TRVStyle 模板样式的设置与使用
2022-07-06 06:47:00 【lyhoo163】
RichView TRVStyle 模板样式设置与使用
一、RichEdit的Style
Style四个重要的属性:
1、TextStyles[TextNo]
默认有5个:
序号 名称
0: Normal text Arial
1: Heading Arial
2: Subheading Arial
3: Keywords Arial
4: Jump 1 Arial
5: Jump 2 Arial
2、ParaStyles[ParaNo]
默认有2个:
序号 名称
0: Paragraph Style 0
1: Centered 0
3、StyleTemplates[StyleNo]

默认有11个:
序号 名称
0 Normal
1 heading 1
2 heading 2
3 heading 3
4 Hyperlink
5 header
6 footer
7 footnote reference
8 endnote reference
9 footnote text
10 endnote text
4、MainStyle
默认有0个(未使用):
二、详细说明
1、TextStyles[TextNo]和ParaStyles[ParaNo]作为样式,TextNo和ParaNo,不是配套使用的。仅供用户在使用AddNL等函数调用时使用:
RVE.AddNL(Text, TextNo, ParaNo); 实际上,TextStyles[TextNo].StyleName 和 ParaStyles[ParaNo].StyleName, 在 TextStyles 和 ParaStyles 用于表示任意格式时没有多大意义,我们可以简单地忽略它们(可能最好将它们保留为空,以防止保存不必要的XML/RVF 文件中的信息)。
2、StyleTemplates[StyleNo],才是软件真实的样式,它0-StyleNo,都定义TextStyles和ParaStyles,使用统一的Name。
StyleTemplates[StyleNo].Name
代码中,完全可以忽略TextStyles[TextNo]和ParaStyles[ParaNo],直接使用StyleTemplates[StyleNo]。
rve.AddNL(S1,
MakeTextStyle(rvs, nil, rvs.StyleTemplates[0]),
MakeParaStyle(rvs, rvs.StyleTemplates[0]));比如,当您将某些格式(例如,将文本设为斜体)应用到由某种文本样式格式化的文本时,可能会在现有文本样式的基础上创建新的文本样式,并且此新样式会继承现有样式的所有未修改属性,包括其样式名称。因此,在编辑操作中添加样式时,StyleName[No] 不能用于识别 TextStyles 和 ParaStyles。如果您使用 StyleTemplates[StyleNo],这时样式模板的名称才有实际意义。
三、实际意义
1、TextStyles[TextNo]和ParaStyles[ParaNo]作为独立单一文档的样式。比如:一篇文档有7个文本的样式,有4种段落的样式。你就可以设置0-6个文字样式,设置0-3个段落样式。它是个性样式的调用。
RVE.AddNL(Text, TextNo, ParaNo);
2、通过StyleTemplates建立行业或单元(或个人),统一规范的样式模板。创建文档时,统一使用StyleTemplates。
rve.AddNL(S1,
MakeTextStyle(rvs, nil, rvs.StyleTemplates[0]),
MakeParaStyle(rvs, rvs.StyleTemplates[0])); 四、TextStyles和ParaStyles的建立
1、对原样式修改
with RVHeader.Style.TextStyles[0] do begin
FontName:='宋体'; // 字体名称;
Size:=10; // 字体大小
Color:= clBlack; // 文本颜色;
Style:=[]; // 文本样式(粗体,斜体,下划线,删除线)
Charset:=DEFAULT_CHARSET; // 字体字符集(用于非unicode文本样式)。
end;
with RVHeader.Style.ParaStyles[0] do begin
FirstIndent:=0; // 段落第一行的缩进,用LeftIndent进行总结;
LeftIndent:=0; // 左边缘缩进;
RightIndent:=0; // 右边缘的缩进;
SpaceBefore:=0; // 段落上方间隔;
SpaceAfter:=0; // 段落下方的空格;
LineSpacing:=200; // 200%
end;
or
RichView.Style.TextStyles.Items[0].FontName:='Monotype Corsiva';
RichView.Style.TextStyles.Items[0].Size:=15;
RichView.Style.TextStyles.Items[0].Color:=clBlack;
RichView.Style.TextStyles.Items[0].Style:=[];
RichView.Style.ParaStyles.Items[0].Alignment:=rvaJustify;
RichView.Style.ParaStyles.Items[0].LineSpacing:=100;2、创建新的样式
RVStyle1.ParaStyles.Clear;
with RVStyle1.ParaStyles.Add do begin
StyleName := 'Paragraph 1';
Alignment := rvaLeft; // 段落进行对齐( left, right, center, justify or distribute)
LastLineAlignment:=rvaLeft; // 下一行段落进行对齐(左对齐,右对齐,居中对齐,对齐或分配);
FirstIndent:=0; // 段落第一行的缩进
LeftIndent:=0; // 左边缘缩进;
RightIndent:=0; // 右边缘的缩进;
SpaceBefore:=5; // 段落上方间隔;
SpaceAfter:=5; // 段落下方的空格;
Border:=:bsNone; // 无边框
end;
with RVStyle1.ParaStyles.Add do begin
StyleName := 'Paragraph 2';
Alignment := rvaCenter; // 段落进行对齐( left, right, center, justify or distribute)
LastLineAlignment:=rvaLeft; // 下一行段落进行对齐(左对齐,右对齐,居中对齐,对齐或分配);
FirstIndent:=0; // 段落第一行的缩进
LeftIndent:=0; // 左边缘缩进;
RightIndent:=0; // 右边缘的缩进;
SpaceBefore:=5; // 段落上方间隔;
SpaceAfter:=5; // 段落下方的空格;
Border.Style:=rvbSingle; // 有边框
Border.VisibleBorders.Top:=True; // 边框是否显示
Border.VisibleBorders.Left:=False;
Border.VisibleBorders.Right:=False;
Border.VisibleBorders.Bottom:=True;
end;
五、StyleTemplates模板样式的创建
1、对原样式的修改
2、重新建立StyleTemplates 六、找到指定名称样式的序号
var
ParaNo, StyleNo: Integer;
HeadingStyleTemplate: TRVStyleTemplate;
...
HeadingStyleTemplate := RVStyle1.StyleTemplates.FindItemByName('heading 1');
ParaNo := MakeParaStyle(RVStyle1, HeadingStyleTemplate);
StyleNo := MakeTextStyle(RVStyle1, nil, HeadingStyleTemplate);
RichViewEdit1.AddNL('This is Heading 1', StyleNo, ParaNo);边栏推荐
- BUU的MISC(不定时更新)
- AttributeError: Can‘t get attribute ‘SPPF‘ on <module ‘models.common‘ from ‘/home/yolov5/models/comm
- Bitcoinwin (BCW): the lending platform Celsius conceals losses of 35000 eth or insolvency
- Day 239/300 注册密码长度为8~14个字母数字以及标点符号至少包含2种校验
- Simple use of MySQL database: add, delete, modify and query
- Office doc add in - Online CS
- 因高额网络费用,Arbitrum 奥德赛活动暂停,Nitro 发行迫在眉睫
- [English] Grammar remodeling: the core framework of English Learning -- English rabbit learning notes (1)
- Day 245/300 JS forEach 多层嵌套后数据无法更新到对象中
- Database basics exercise part 2
猜你喜欢

Reflex WMS medium level series 3: display shipped replaceable groups

Biomedical English contract translation, characteristics of Vocabulary Translation

Attributeerror: can 't get attribute' sppf 'on < module' models. Common 'from' / home / yolov5 / Models / comm

Reflex WMS中阶系列3:显示已发货可换组

A method to measure the similarity of time series: from Euclidean distance to DTW and its variants

Bitcoinwin (BCW): 借贷平台Celsius隐瞒亏损3.5万枚ETH 或资不抵债
![[ 英語 ] 語法重塑 之 動詞分類 —— 英語兔學習筆記(2)](/img/3c/c25e7cbef9be1860842e8981f72352.png)
[ 英語 ] 語法重塑 之 動詞分類 —— 英語兔學習筆記(2)

Today's summer solstice

Cobalt strike feature modification

On the first day of clock in, click to open a surprise, and the switch statement is explained in detail
随机推荐
[ 英语 ] 语法重塑 之 动词分类 —— 英语兔学习笔记(2)
钓鱼&文件名反转&office远程模板
女生学软件测试难不难 入门门槛低,学起来还是比较简单的
librosa音频处理教程
AttributeError: Can‘t get attribute ‘SPPF‘ on <module ‘models. common‘ from ‘/home/yolov5/models/comm
Day 245/300 JS foreach data cannot be updated to the object after multi-layer nesting
LeetCode每日一题(971. Flip Binary Tree To Match Preorder Traversal)
UNIPRO Gantt chart "first experience": multi scene exploration behind attention to details
Successfully solved typeerror: data type 'category' not understood
AI on the cloud makes earth science research easier
Chapter 7 - thread pool of shared model
Use shortcut LNK online CS
SAP SD发货流程中托盘的管理
18.多级页表与快表
基于购买行为数据对超市顾客进行市场细分(RFM模型)
CS certificate fingerprint modification
CS passed (cdn+ certificate) PowerShell online detailed version
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
将ue4程序嵌入qt界面显示
Database basics exercise part 2