当前位置:网站首页>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 internationalization of domestic games is inseparable from professional translation companies
- 成功解决TypeError: data type ‘category‘ not understood
- Day 248/300 thoughts on how graduates find jobs
- Traffic encryption of red blue confrontation (OpenSSL encrypted transmission, MSF traffic encryption, CS modifying profile for traffic encryption)
- 查询字段个数
- AttributeError: Can‘t get attribute ‘SPPF‘ on <module ‘models.common‘ from ‘/home/yolov5/models/comm
- Reflex WMS medium level series 3: display shipped replaceable groups
- librosa音频处理教程
- Phishing & filename inversion & Office remote template
- Introduction and underlying analysis of regular expressions
猜你喜欢

(practice C language every day) reverse linked list II

Database basics exercise part 2

When my colleague went to the bathroom, I helped my product sister easily complete the BI data product and got a milk tea reward

CS passed (cdn+ certificate) PowerShell online detailed version

Introduction and underlying analysis of regular expressions

Today's summer solstice

How effective is the Chinese-English translation of international economic and trade contracts

In English translation of papers, how to do a good translation?

kubernetes集群搭建Zabbix监控平台

How much is it to translate Chinese into English for one minute?
随机推荐
《从0到1:CTFer成长之路》书籍配套题目(周更)
Delete external table source data
SQL Server Manager studio (SSMS) installation tutorial
查询字段个数
LeetCode每日一题(1870. Minimum Speed to Arrive on Time)
Financial German translation, a professional translation company in Beijing
基于PyTorch和Fast RCNN快速实现目标识别
AI on the cloud makes earth science research easier
[Yu Yue education] flower cultivation reference materials of Weifang Vocational College
Simple query cost estimation
At the age of 26, I changed my career from finance to software testing. After four years of precipitation, I have been a 25K Test Development Engineer
(practice C language every day) reverse linked list II
Reflex WMS medium level series 3: display shipped replaceable groups
LeetCode每日一题(1997. First Day Where You Have Been in All the Rooms)
[ 英语 ] 语法重塑 之 动词分类 —— 英语兔学习笔记(2)
[unity] how to export FBX in untiy
In English translation of papers, how to do a good translation?
UniPro甘特图“初体验”:关注细节背后的多场景探索
接口自动化测试框架:Pytest+Allure+Excel
同事上了个厕所,我帮产品妹子轻松完成BI数据产品顺便得到奶茶奖励