Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Avoiding Word to break entered text
Message
From
10/05/2019 17:37:49
 
 
To
10/05/2019 15:37:28
General information
Forum:
Microsoft Office
Category:
Word
Miscellaneous
Thread ID:
01668533
Message ID:
01668539
Views:
17
Here is a way to clean those tags:
Imports OpenXmlPowerTools
Imports DocumentFormat.OpenXml.Packaging

Dim lcFile As String = ""

' Initialization
lcFile = MicrosoftOfficeFile.Text

' If the file is empty
If lcFile.Length = 0 Then
   MessageBox.Show("The file cannot be empty.", oApp.cTitle, MessageBoxButtons.OK, MessageBoxIcon.Stop)
   Exit Sub
End If

Using loWordprocessingDocument As WordprocessingDocument = WordprocessingDocument.Open(lcFile, True)

   Dim loSimplifyMarkupSettings As SimplifyMarkupSettings = New SimplifyMarkupSettings With {
      .RemoveComments = True,
      .RemoveContentControls = True,
      .RemoveEndAndFootNotes = True,
      .RemoveFieldCodes = False,
      .RemoveLastRenderedPageBreak = True,
      .RemovePermissions = True,
      .RemoveProof = True,
      .RemoveRsidInfo = True,
      .RemoveSmartTags = True,
      .RemoveSoftHyphens = True,
      .ReplaceTabsWithSpaces = True
   }

   MarkupSimplifier.SimplifyMarkup(loWordprocessingDocument, loSimplifyMarkupSettings)

End Using

MessageBox.Show("The operation completed successfully.", oApp.cTitle, MessageBoxButtons.OK, MessageBoxIcon.Information)
You will need to install the two NuGet packages.

https://stackoverflow.com/questions/7752932/simplify-clean-up-xml-of-a-docx-word-document
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Previous
Reply
Map
View

Click here to load this message in the networking platform