Javascript 如何将段落文本拆分为“文本”;dot leader";在wordjsapi中?
有没有办法在Word JS API中用“点首”分隔段落 似乎段落。文本将跳过“点前导”并在末尾添加页码,没有任何空格或符号,这是不好的Javascript 如何将段落文本拆分为“文本”;dot leader";在wordjsapi中?,javascript,office-js,Javascript,Office Js,有没有办法在Word JS API中用“点首”分隔段落 似乎段落。文本将跳过“点前导”并在末尾添加页码,没有任何空格或符号,这是不好的 await Word.run(async (context) => { const ps = context.document.body.paragraphs; ps.load(); await context.sync(); ps.items.forEach((p) => { let newLine =
await Word.run(async (context) => {
const ps = context.document.body.paragraphs;
ps.load();
await context.sync();
ps.items.forEach((p) => {
let newLine = p.text;
if (p.text != "") {
// How to split with 'dot leader'?
// Page number is from 1 to 1500 and multiple lines are ended with numbers
html_main_content += "\n" + '<li><a href="page_num_at_the_end">' + p.text + "</a></li>" + "\n";
console.log(p);
}
});
await context.sync();
});
等待Word.run(异步(上下文)=>{
const ps=context.document.body.parations;
ps.load();
wait context.sync();
ps.items.forEach((p)=>{
设newLine=p.text;
如果(p.text!=“”){
//如何使用“点引线”拆分?
//页码从1到1500,多行以数字结尾
html\u main\u content+=“\n”+”“+”\n”;
控制台日志(p);
}
});
wait context.sync();
});