Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Avoiding Word to break entered text
Message
De
10/05/2019 17:37:49
 
 
À
10/05/2019 15:37:28
Information générale
Forum:
Microsoft Office
Catégorie:
Word
Divers
Thread ID:
01668533
Message ID:
01668539
Vues:
18
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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform