创建图片样式
function 创建图片样式(styleName = "图片")
{
try{
ActiveDocument.Styles.Item(styleName).Delete();
}catch(e){
Console.log("样式不存在");
}
ActiveDocument.Styles.Add(styleName, wdStyleTypeParagraph);
(obj=>{
obj.Alignment = wdAlignParagraphCenter;
obj.IndentCharWidth(0);
})(ActiveDocument.Styles.Item(styleName).ParagraphFormat);
}
创建图片样式();
批量设置图片
function 批量设置图片()
{
var arr = [...ActiveDocument.InlineShapes];
Application.ScreenUpdating = false;
arr.forEach(shape=>{
if(shape.Type == wdInlineShapePicture){
shape.Range.Style = "图片";
}
shape.Line.Visible = msoTrue;
});
Application.ScreenUpdating = true;
Console.log('批量设置【图片】完成。');
}