Skip to content

Commit bbb743c

Browse files
authored
Merge pull request #5 from tnmquann/tnmquann-patch-4
Add new features for image processing
2 parents d0c6ec8 + 8c9adef commit bbb743c

File tree

2 files changed

+50
-1
lines changed

2 files changed

+50
-1
lines changed

customUI/customUI14.xml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,15 @@
7979
<button id="testButton1-21" label="Fix &#272;A"
8080
imageMso="SlidesPerPageSlideOutline"
8181
onAction= "chuanda" />
82+
<button id="testButton1-22" label="Chuy&#7875;n &#7843;nh v&#7873; Inline with Text"
83+
imageMso="TextWrappingInLineWithText"
84+
onAction= "PictureInlineWithText" />
85+
<button id="testButton1-23" label="Canh gi&#7919;a h&#236;nh &#7843;nh"
86+
imageMso="AlignCenter"
87+
onAction= "PicCenter" />
88+
<button id="testButton1-24" label="Chu&#7849;n h&#243;a h&#236;nh &#7843;nh"
89+
imageMso="AlignCenter"
90+
onAction= "InlineAndCenterAllImages" />
8291
</menu>
8392
</group>
8493

@@ -251,4 +260,4 @@
251260
</tab>
252261
</tabs>
253262
</ribbon>
254-
</customUI>
263+
</customUI>

module/Module 19.bas

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
Public Sub PictureInlineWithText(ByVal control As Office.IRibbonControl)
2+
Dim i As Integer
3+
For i = ActiveDocument.Shapes.Count To 1 Step -1
4+
Select Case ActiveDocument.Shapes(i).Type
5+
Case msoEmbeddedOLEObject, msoLinkedOLEObject, msoLinkedPicture, msoOLEControlObject, msoPicture, wdInlineShapePicture, wdInlineShapeLinkedPicture
6+
ActiveDocument.Shapes(i).ConvertToInlineShape
7+
End Select
8+
Next i
9+
Selection.HomeKey Unit:=wdStory
10+
End Sub
11+
12+
Public Sub PicCenter(ByVal control As Office.IRibbonControl)
13+
Dim Pic As InlineShape
14+
Selection.HomeKey Unit:=wdStory
15+
For Each Pic In ActiveDocument.InlineShapes
16+
If Pic.Type = wdInlineShapePicture Then
17+
Pic.Select
18+
Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
19+
End If
20+
Next
21+
End Sub
22+
23+
Public Sub InlineAndCenterAllImages(ByVal control As Office.IRibbonControl)
24+
Dim i As Integer
25+
For i = ActiveDocument.Shapes.Count To 1 Step -1
26+
Select Case ActiveDocument.Shapes(i).Type
27+
Case msoEmbeddedOLEObject, msoLinkedOLEObject, msoLinkedPicture, msoOLEControlObject, msoPicture, wdInlineShapePicture, wdInlineShapeLinkedPicture
28+
ActiveDocument.Shapes(i).ConvertToInlineShape
29+
End Select
30+
Next i
31+
Selection.HomeKey Unit:=wdStory
32+
Dim Pic As InlineShape
33+
Selection.HomeKey Unit:=wdStory
34+
For Each Pic In ActiveDocument.InlineShapes
35+
If Pic.Type = wdInlineShapePicture Then
36+
Pic.Select
37+
Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
38+
End If
39+
Next
40+
End Sub

0 commit comments

Comments
 (0)