当前位置:网站首页>WPS的JS宏实现图片正文在同一段落的分离方法
WPS的JS宏实现图片正文在同一段落的分离方法
2022-06-24 06:57:00 【红狐格格】
当图片处于正文的行尾时,有时候人眼很难判断出来。但是在编辑格式时又很容易出错,图片需要居中处理,正文需要左对齐。
如下JS代码实现了:图文分离
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)
{//图片高度大于正文字体高度的两倍,进行居中处理。否则判定为正文描述内容。
rangShapes.Item(i).Select();
ActiveW.Selection.MoveLeft(wdCharacter, 2, wdExtend);
if(ActiveW.Selection.Paragraphs.Count == 1)
{//图文在同一段落中,在图片前增加回车换行。
rangShapes.Item(i).Select();
ActiveW.Selection.MoveLeft(wdCharacter, 1, wdMove);
ActiveW.Selection.TypeParagraph();
ActiveW.Selection.Style = "正文";
}
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;//图片居中
}
i++;
}
边栏推荐
- Solution of electric education system for intelligent supervision station
- Installation and use of selenium IDE
- Leetcode 207: course schedule (topological sorting determines whether the loop is formed)
- Ad-gcl:advantageous graph augmentation to improve graph contractual learning
- Swift Extension ChainLayout(UI的链式布局)(源码)
- The applet reads more than 20 data, and the cloud function reads more than 100 restrictions
- [ACNOI2022]做过也不会
- Getting started with crawler to giving up 06: crawler play Fund (with code)
- Live broadcast review | detailed explanation of koordinator architecture of cloud native hybrid system (complete ppt attached)
- LINQ query (2)
猜你喜欢

OC extension detects whether an app is installed on the mobile phone (source code)

2022年制冷与空调设备运行操作上岗证题库及模拟考试

Graphmae ---- quick reading of papers

Coordinate transformation of graphic technology

More than observation | Alibaba cloud observable suite officially released

2021-03-04 COMP9021第六节课笔记

io模型初探

Solve the problem of notebook keyboard disabling failure

Markdown 实现文内链接跳转

Écouter le réseau d'extension SWIFT (source)
随机推荐
OC extension detects whether an app is installed on the mobile phone (source code)
More than observation | Alibaba cloud observable suite officially released
Live broadcast review | detailed explanation of koordinator architecture of cloud native hybrid system (complete ppt attached)
疫情下更合适的开发模式
C语言_字符串与指针的爱恨情仇
pyQt 中 QMenu 响应
Swift extension networkutil (network monitoring) (source code)
Swift 基礎 閉包/Block的使用(源碼)
Search and recommend those things
[introduction to point cloud dataset]
"Adobe international certification" about Adobe Photoshop, creating and modifying brush tutorials?
[teacher zhaoyuqiang] use the Oracle tracking file
Écouter le réseau d'extension SWIFT (source)
权限模型 DAC ACL RBAC ABAC
软件工程导论——第三章——需求分析
Atguigu---16-custom instruction
Interview tutorial - multi thread knowledge sorting
Optimization and practice of Tencent cloud EMR for cloud native containerization based on yarn
LINQ query (2)
一文带你了解Windows操作系统安全,保护自己的电脑不受侵害