我是DXL和学习的新手。我想检查模块中某些单词的所有属性,以将其更改为斜体。
示例:
特定词=更改
在属性/列A中的DXL脚本之前:“此要求应更改”
属性/列A中的DXL脚本之后:“此要求应更改”
代码段
for itemRef in f do
{
if(shType=="Formal")
{
filtering off;
m = read(fullName(itemRef), false)
Object o
for o in m do
{
//Operation for changing words to italic
}
close(moduleReference);
}
}
更新代码
void ChangeItalic()
{
Module m = current
filtering off;
Object o
for o in m do
{
int i, j
string t = o."Object Text"
string ModuleName = m."Name"
string ObjectName = identifier(o)
print ModuleName "\n"
print ObjectName "\n"
print t
if(matches("[Ll]astenheft",t)){
print "changed" "\n"
i = start 0
j = end 0
t = t[0:(i-1)] "\\i " t[match 0] "\\i0 " t[j+1:]
o."Object Text" = richText t
}
}
}
// Main-Method
void main(void)
{
ChangeItalic();
}
main()
答案 0 :(得分:1)
这是脚本的“胆量”:
Object o = current
int i, j
string t = o."Object Text"
if (matches("[Cc]hange", t)){
i = start 0
j = end 0
t = t[0:(i-1)] "\\i " t[match 0] "\\i0 " t[j+1:]
o."Object Text" = richText t
}
此脚本将在当前对象上运行,并且如果在对象文本中,则将单词“更改”更改为斜体。如果只想显示,它将有所不同。
不幸的是,我不知道您是要以斜体显示(在列中)还是要在属性中将其更改为斜体。