当前位置:网站首页>The JS macro of WPS implements the separation method of picture text in the same paragraph
The JS macro of WPS implements the separation method of picture text in the same paragraph
2022-06-24 08:25:00 【Red fox lattice】
When the picture is at the end of the line of the text , Sometimes it's hard for the human eye to tell . But it is easy to make mistakes when editing the format , Pictures need to be centered , The text needs to be left aligned .
as follows JS The code implements : Picture text separation
let rangShapes = Documents.Item(filepath).Range(startP,endP).InlineShapes;
while(i<=count)
{
rangShapes.Item(i).Select();
if(rangShapes.Item(i).Height >= Selection.Font.Size*2)
{// The height of the picture is greater than twice the height of the text font , Center . Otherwise, it will be judged as the content described in the text .
rangShapes.Item(i).Select();
ActiveW.Selection.MoveLeft(wdCharacter, 2, wdExtend);
if(ActiveW.Selection.Paragraphs.Count == 1)
{// Text and words in the same paragraph , Add carriage return before the picture .
rangShapes.Item(i).Select();
ActiveW.Selection.MoveLeft(wdCharacter, 1, wdMove);
ActiveW.Selection.TypeParagraph();
ActiveW.Selection.Style = " Text ";
}
rangShapes.Item(i).Select();
ActiveW.Selection.ParagraphFormat.CharacterUnitFirstLineIndent = 0;
ActiveW.Selection.ParagraphFormat.FirstLineIndent = 0;
ActiveW.Selection.ParagraphFormat.CharacterUnitLeftIndent = 0;
ActiveW.Selection.ParagraphFormat.LeftIndent = 0;
ActiveW.Selection.ParagraphFormat.CharacterUnitRightIndent = 0;
ActiveW.Selection.ParagraphFormat.RightIndent = 0;
ActiveW.Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter;// picture centering
}
i++;
}
边栏推荐
猜你喜欢
随机推荐
Swift Extension NetworkUtil(網絡監聽)(源碼)
transformers PreTrainedTokenizer类
软件过程与项目管理期末复习与重点
Promise的使用场景
Swift foundation features unique to swift
11--无重复字符的最长子串
Chart list Performance Optimization: minimum resource consumption in the visualization area
Introduction to software engineering - Chapter 3 - Requirements Analysis
Opening chapter of online document technology - rich text editor
Small sample fault diagnosis - attention mechanism code - Implementation of bigru code parsing
Final review and key points of software process and project management
JVM underlying principle analysis
疫情下更合适的开发模式
2021-03-09 COMP9021第七节课笔记
RCNN、Fast-RCNN、Faster-RCNN介绍
WPS的JS宏实现图片正文在同一段落的分离方法
All you know is the test pyramid?
[introduction to point cloud dataset]
2021-03-16 COMP9021第九节课笔记
Pat 1157: school anniversary







![3D数学基础[十七] 平方反比定理](/img/59/bef931d96883288766fc94e38e0ace.png)
