当前位置:网站首页>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);
边栏推荐
- 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
- AttributeError: Can‘t get attribute ‘SPPF‘ on <module ‘models.common‘ from ‘/home/yolov5/models/comm
- 成功解决TypeError: data type ‘category‘ not understood
- How to translate professional papers and write English abstracts better
- BUU的MISC(不定时更新)
- [brush questions] how can we correctly meet the interview?
- How to reconstruct the class explosion caused by m*n strategies?
- 成功解决AttributeError: Can only use .cat accessor with a ‘category‘ dtype
- Day 246/300 SSH connection prompt "remote host identification has changed!"
- Phishing & filename inversion & Office remote template
猜你喜欢
详解SQL中Groupings Sets 语句的功能和底层实现逻辑
Today's summer solstice
26岁从财务转行软件测试,4年沉淀我已经是25k的测开工程师...
SQL Server manager studio(SSMS)安装教程
同事上了个厕所,我帮产品妹子轻松完成BI数据产品顺便得到奶茶奖励
Reflex WMS medium level series 3: display shipped replaceable groups
CS-证书指纹修改
利用快捷方式-LNK-上线CS
钓鱼&文件名反转&office远程模板
CS passed (cdn+ certificate) PowerShell online detailed version
随机推荐
接口自动化测试框架:Pytest+Allure+Excel
一文读懂简单查询代价估算
Redis Foundation
kubernetes集群搭建Zabbix监控平台
Day 246/300 SSH connection prompt "remote host identification has changed!"
librosa音频处理教程
SSO process analysis
因高额网络费用,Arbitrum 奥德赛活动暂停,Nitro 发行迫在眉睫
ROS学习_基础
万丈高楼平地起,每个API皆根基
What are the commonly used English words and sentences about COVID-19?
SQL Server Manager studio (SSMS) installation tutorial
Fedora/REHL 安装 semanage
Brief introduction to the curriculum differences of colleges and universities at different levels of machine human major -ros1/ros2-
[Yu Yue education] Dunhuang Literature and art reference materials of Zhejiang Normal University
18.多级页表与快表
Cobalt strike feature modification
A method to measure the similarity of time series: from Euclidean distance to DTW and its variants
Chinese English comparison: you can do this Best of luck
【软件测试进阶第1步】自动化测试基础知识