先上图;
看到上面这个图
第一个想到的是,拼音填空可用在word中自由;
第二个想到的是,中文,拼音,英语,可用三合一行显示了。记住是三合一行,和三行还是有区别的,三行的意思是,独立三行,对齐,删除都是独立的,拼音指南是二合一行;
第三个想到的是三合一行可用,四合一,5合1,N合1,都没问题,关键是在WPS word中(测试过Ms365 word 不支持3合1)
这个对于选词填拼音啥的,还是挺有用的;其他应用正在想
下面是小程序中的源码
n2one(){// 多合一
let app=this
var result ='ok'
//显示的内容,可以用参数凭接 ws1 最底下,以此网上
var ws1=['a1b','中1国1','a3','9m4','1d5']
var ws2=['a2b','中2国1','a3','8m4','2d5']
var ws3=['a3b','中3国1','a3','7m4','3d5']
var ws4=['a4b','中4国1','a3','6m4','4d5']
var ws5=['a5b','中5国1','a3','5m4','4d5']
var wshow=[ws1,ws2,ws3,ws4,ws5]
var jsf1={dfont:'"Arial"',//正文字体,有引号注意,其实就是a1d的字体,只有第一个有用
color:'"FF0033"',//正文颜色,有引号注意,默认黑色,颜色只有一个地方设置
dsize:'"120"',//24等于12磅字,除以2,有引号 其实就是a1d的字体大小,只有第一个有用
}
var jsf2={
color:'"FF6600"',//颜色,有引号注意
ufont:'宋体',//音标字体,没引号
usize:'hps100',//20磅
uhigh:'up 59',//11表示24/2-1,距离是0,这个24是downword的尺寸,如果是40,那么要填写19,这里24就是jsf1里的24
//59表示120/2-1,距离是0,这个120是downword的尺寸,如果是40,那么要填写19,这里120就是jsf1里的120
}
var jsf3={
color:'"FFFF00"',//颜色,有引号注意
ufont:'华文行楷',//音标字体,没引号
usize:'hps100',//12磅
uhigh:'up 49',//11表示24/2-1,距离是0,这个24是downword的尺寸,如果是40,那么要填写19
}
var jsf4={
color:'"00FF00"',//颜色,有引号注意
ufont:'华文彩云',//音标字体,没引号
usize:'hps100',//12磅
uhigh:'up 49',//11表示24/2-1,距离是0,这个24是downword的尺寸,如果是40,那么要填写19
}
var jsf5={
color:'"33FFFF"',//颜色,有引号注意
ufont:'Arial Unicode MS',//音标字体,没引号
usize:'hps100',//12磅
uhigh:'up 49',//11表示24/2-1,距离是0,这个24是downword的尺寸,如果是40,那么要填写19
}
var jshow=[jsf1,jsf2,jsf3,jsf4,jsf5]
//console.log(jshow,jshow[1].dfont)
let bk4=' '
//wordtemplatee=<?xml 有空格是不行的
let wordtemplate='<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <?mso-application progid="Word.Document"?> <w:wordDocument xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml"> <w:docPr> <w:view w:val="print"/> <w:zoom w:percent="120"/> </w:docPr> <w:body> <w:p> <w:r> </w:r> </w:p> </w:body> <w:sectPr> </w:sectPr> </w:wordDocument>'
let wpbegin='<w:p>'
let wpend='</w:p>'
let bodyend='</w:body>'
let outstr=''
// easyword 表示普通的文字,不用多合一
let easyword='<w:r><w:rPr><w:rFonts w:ascii="Arial" w:h-ansi="Arial" w:cs="Arial" w:hint="fareast"/><w:color w:val="FF0000"/><w:sz w:val="24"/><w:sz-cs w:val="24"/><w:lang w:val="EN-US" w:fareast="ZH-CN"/></w:rPr><w:t>easyword</w:t></w:r>'
let copyword=wordtemplate
let bl=copyword.indexOf(wpbegin)
let bodybegin=copyword.slice(0,bl)
let el=copyword.indexOf(bodyend)
bodyend=copyword.slice(el)
// c1str 把upword 替换成c1str就是递归,把\ 改成\\ 原字符串 <w:r><w:rPr></w:rPr><w:fldChar w:fldCharType="begin"/></w:r><w:r><w:rPr></w:rPr><w:instrText> EQ \* jc0 \* "Font:Arial Unicode MS" \* hps40 \o \ad(\s \up 11(</w:instrText></w:r><w:r><w:rPr><w:color w:val="FF0000"/></w:rPr><w:instrText>upword)</w:instrText></w:r><w:r><w:rPr><w:rFonts w:ascii="Arial" w:h-ansi="Arial" w:cs="Arial" w:hint="default"/><w:sz w:val="24"/><w:sz-cs w:val="24"/><w:color w:val="000000"/></w:rPr><w:instrText>,downword)</w:instrText></w:r><w:r><w:rPr></w:rPr><w:fldChar w:fldCharType="end"/></w:r>
let c1str='<w:r><w:rPr></w:rPr><w:fldChar w:fldCharType="begin"/></w:r><w:r><w:rPr></w:rPr><w:instrText> EQ \\* jc0 \\* "Font:Arial Unicode MSx" \\* hps40x \\o \\ad(\\s \\up 11x(</w:instrText></w:r><w:r><w:rPr><w:color w:val="FF0000x"/></w:rPr><w:instrText>upword)</w:instrText></w:r><w:r><w:rPr><w:rFonts w:ascii="Arialx" w:h-ansi="Arialx" w:cs="Arialx" w:hint="default"/><w:sz w:val="24x"/><w:sz-cs w:val="24x"/><w:color w:val="000000x"/></w:rPr><w:instrText>,downword)</w:instrText></w:r><w:r><w:rPr></w:rPr><w:fldChar w:fldCharType="end"/></w:r>'
// ccut 只有最下面这个单词的格式才需要再 ccut里边设置,其他都删除;
let ccut='<w:rFonts w:ascii="Arialx" w:h-ansi="Arialx" w:cs="Arialx" w:hint="default"/><w:sz w:val="24x"/><w:sz-cs w:val="24x"/><w:color w:val="000000x"/>'
let showall=''
let l=0
for(let j=0;j<wshow[0].length;j++)
{
outstr=c1str
for(let i=0;i<wshow.length-2;i++)
{
if(i==0){
// 设置a1d的格式
outstr=app.replaceall(outstr,'"000000x"',jshow[0].color)
outstr=app.replaceall(outstr,'"Arialx"',jshow[0].dfont)
outstr=app.replaceall(outstr,'"24x"',jshow[0].dsize)
// 设置a2d的格式
outstr=app.replaceall(outstr,'"FF0000x"',jshow[1].color)
outstr=app.replaceall(outstr,'Arial Unicode MSx',jshow[1].ufont)
outstr=app.replaceall(outstr,'hps40x',jshow[1].usize)
outstr=app.replaceall(outstr,'up 11x',jshow[1].uhigh)
}
else
{
// 设置i+2的格式,最后第二个已经设置完格式
outstr=app.replaceall(outstr,'"FF0000x"',jshow[i+1].color)
outstr=app.replaceall(outstr,'Arial Unicode MSx',jshow[i+1].ufont)
outstr=app.replaceall(outstr,'hps40x',jshow[i+1].usize)
outstr=app.replaceall(outstr,'up 11x',jshow[i+1].uhigh)
}
outstr=app.replaceall(outstr,'downword',wshow[i][j]) //a1d
outstr=app.replaceall(outstr,'upword',c1str)
}
l=wshow.length
// console.log(l0,l0-1,l0-2)
// 设置最后一个格式
outstr=app.replaceall(outstr,'"FF0000x"',jshow[l-1].color)
outstr=app.replaceall(outstr,'Arial Unicode MSx',jshow[l-1].ufont)
outstr=app.replaceall(outstr,'hps40x',jshow[l-1].usize)
outstr=app.replaceall(outstr,'up 11x',jshow[l-1].uhigh)
// 最后2个替换
outstr=app.replaceall(outstr,'upword',wshow[l-1][j]) //a5d
outstr=app.replaceall(outstr,'downword',wshow[l-2][j]) //a4d
showall=showall+outstr+easyword.replace('easyword',bk4)
}
showall=app.replaceall(showall,ccut,'')
outstr=bodybegin+wpbegin+showall+wpend+bodyend
app.data.outStr=outstr;//把数据传递出去剪贴板数据
app.setData({
result:'ok'
});
result;//不要修改,这里就是反馈函数的值给外面
wx.setClipboardData({
data:app.data.outStr,
success: function(res) {
},
fail: function(res) {
}
});
},
结构是产生一个word
下面是一个xml,5列,另存为abc.xml 然后用wps打开
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <?mso-application progid="Word.Document"?> <w:wordDocument xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml"> <w:docPr> <w:view w:val="print"/> <w:zoom w:percent="120"/> </w:docPr> <w:body> <w:p><w:r><w:rPr></w:rPr><w:fldChar w:fldCharType="begin"/></w:r><w:r><w:rPr></w:rPr><w:instrText> EQ \* jc0 \* "Font:宋体" \* hps100 \o \ad(\s \up 59(</w:instrText></w:r><w:r><w:rPr><w:color w:val="FF6600"/></w:rPr><w:instrText><w:r><w:rPr></w:rPr><w:fldChar w:fldCharType="begin"/></w:r><w:r><w:rPr></w:rPr><w:instrText> EQ \* jc0 \* "Font:华文行楷" \* hps100 \o \ad(\s \up 49(</w:instrText></w:r><w:r><w:rPr><w:color w:val="FFFF00"/></w:rPr><w:instrText><w:r><w:rPr></w:rPr><w:fldChar w:fldCharType="begin"/></w:r><w:r><w:rPr></w:rPr><w:instrText> EQ \* jc0 \* "Font:华文彩云" \* hps100 \o \ad(\s \up 49(</w:instrText></w:r><w:r><w:rPr><w:color w:val="00FF00"/></w:rPr><w:instrText><w:r><w:rPr></w:rPr><w:fldChar w:fldCharType="begin"/></w:r><w:r><w:rPr></w:rPr><w:instrText> EQ \* jc0 \* "Font:Arial Unicode MS" \* hps100 \o \ad(\s \up 49(</w:instrText></w:r><w:r><w:rPr><w:color w:val="33FFFF"/></w:rPr><w:instrText>a5b)</w:instrText></w:r><w:r><w:rPr></w:rPr><w:instrText>,a4b)</w:instrText></w:r><w:r><w:rPr></w:rPr><w:fldChar w:fldCharType="end"/></w:r>)</w:instrText></w:r><w:r><w:rPr></w:rPr><w:instrText>,a3b)</w:instrText></w:r><w:r><w:rPr></w:rPr><w:fldChar w:fldCharType="end"/></w:r>)</w:instrText></w:r><w:r><w:rPr></w:rPr><w:instrText>,a2b)</w:instrText></w:r><w:r><w:rPr></w:rPr><w:fldChar w:fldCharType="end"/></w:r>)</w:instrText></w:r><w:r><w:rPr><w:rFonts w:ascii="Arial" w:h-ansi="Arial" w:cs="Arial" w:hint="default"/><w:sz w:val="120"/><w:sz-cs w:val="120"/><w:color w:val="FF0033"/></w:rPr><w:instrText>,a1b)</w:instrText></w:r><w:r><w:rPr></w:rPr><w:fldChar w:fldCharType="end"/></w:r><w:r><w:rPr><w:rFonts w:ascii="Arial" w:h-ansi="Arial" w:cs="Arial" w:hint="fareast"/><w:color w:val="FF0000"/><w:sz w:val="24"/><w:sz-cs w:val="24"/><w:lang w:val="EN-US" w:fareast="ZH-CN"/></w:rPr><w:t> </w:t></w:r></w:p></w:body> <w:sectPr> </w:sectPr> </w:wordDocument>
这个xml的效果
5个颜色,字体;大小也可调整;