Want to Stop Importing Word Document Content as Wiki Markup

Brock Price
Contributor
May 16, 2020

When I import a Word document into Confluence, several wiki markup macros appear. (Something as simple as importing a bracket "[" will trigger the macro.)

Is there any way to stop this behavior? I don't want any wiki macro content in my pages after importing documents.

1 answer

0 votes
irshad May 16, 2020
Brock Price
Contributor
May 17, 2020

I created a solution. It wasn't hinted at anywhere on the page you suggested. You can run VBA on the content to Find/Replace ASCII characters (like the bracket) with their entity numbers. Then import.

Like Deniz Altin likes this
Deniz Altin
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 30, 2021

@Brock Price Do you happen to have the VBA code lying around somewhere?

Brock Price April 30, 2021

Hi Deniz.  Below is what I used.  It was far from a silver bullet, but it did help.  Some characters I couldn't escape.  I suspect I commented out code (below) that wasn't working.  If you use, please test prior to using.

 

Sub EscapeSpecialChar()
'This code will escape these characters: % | { @ # *

ActiveDocument.Select

' With Selection.Find
' .ClearFormatting
' .text = "]"
' With .Replacement
' .ClearFormatting
' .text = "U+0005D"
' End With
' .Execute Replace:=wdReplaceAll
' End With

' With Selection.Find
' .ClearFormatting
' .text = "["
' With .Replacement
' .ClearFormatting
' .text = "U+0005B"
' End With
' .Execute Replace:=wdReplaceAll
' End With

With Selection.Find
.ClearFormatting
.text = "%"
With .Replacement
.ClearFormatting
.text = "\%"
End With
.Execute Replace:=wdReplaceAll
End With

ActiveDocument.Select

With Selection.Find
.ClearFormatting
.text = "|"
With .Replacement
.ClearFormatting
.text = "\|"
End With
.Execute Replace:=wdReplaceAll
End With

' With Selection.Find
' .ClearFormatting
' .text = ":"
' With .Replacement
' .ClearFormatting
' .text = ":"
' End With
' .Execute Replace:=wdReplaceAll
' End With

With Selection.Find
.ClearFormatting
.text = "{"
With .Replacement
.ClearFormatting
.text = "\{"
End With
.Execute Replace:=wdReplaceAll
End With

With Selection.Find
.ClearFormatting
.text = "@"
With .Replacement
.ClearFormatting
.text = "\@"
End With
.Execute Replace:=wdReplaceAll
End With

With Selection.Find
.ClearFormatting
.text = "#"
With .Replacement
.ClearFormatting
.text = "#"
End With
.Execute Replace:=wdReplaceAll
End With

With Selection.Find
.ClearFormatting
.text = "*"
With .Replacement
.ClearFormatting
.text = "*"
End With
.Execute Replace:=wdReplaceAll
End With

End Sub

Like Deniz Altin likes this
Deniz Altin
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 30, 2021

Thanks a lot, Brock! Much appreciated

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events