What You Can Do with GroupDocs.Redaction for Python via .NET

Edit or Hide Private Text in WORD Files with Python

Clean up sensitive content in your WORD files using GroupDocs.Redaction for Python via .NET and Python. Keep personal or work documents safe.

Steps to Redact Text in Word Files

Use GroupDocs.Redaction for Python via .NET in your Python via .NET apps to quickly remove or hide sensitive information.

  1. Start a Redactor and load the Word file.
  2. Pick the redaction settings you want.
  3. Enter what text to find and what to replace it with.
  4. Run the redaction and save your document.
import groupdocs.redaction as gr
import groupdocs.redaction.redactions as grr

# How to redact text in a WORD file

# Set the options for redaction
# Pick the text to replace and the new value
repl_opt = grr.ReplacementOptions("[redacted]")
        
redaction = grr.ExactPhraseRedaction("Text to hide", repl_opt)

# Load the file using the Redactor constructor
with gr.Redactor("input.docx") as redactor:

    # Apply and save your redacted WORD file
    result = redactor.apply(redaction)
    redactor.save()
pip install groupdocs-redaction-net
click to copy
copied
More examples Documentation

More Tools for Redaction

GroupDocs.Redaction for Python via .NET gives you the tools to clear sensitive content in many file formats. Keep your documents safe to share.

Overview of redaction options

Replace sensitive text

Search for text or patterns and replace them with something else. Regex is supported too.

Cover up private images

Hide or overlay parts of images. Tweak appearance and size as needed.

Clear hidden metadata

Erase hidden details like author names, creation dates, and comments.

Redact Patterns with Regex

Use regular expressions to find and clean text patterns like emails, names, or IDs.

Python

import groupdocs.redaction as gr
import groupdocs.redaction.options as gro
import groupdocs.redaction.redactions as grr

# Set an EMAIL regex rule and replacement text
repl_opt = grr.ReplacementOptions(color)
emailRegex = "[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}"

redaction = grr.RegexRedaction(emailRegex, repl_opt)

# Open your document
with gr.Redactor("source.docx") as redactor:

    # Apply the redaction settings
    result = redactor.apply(redaction)

    # Save the final version
    so = gro.SaveOptions()
    so.add_suffix = True
    so.rasterize_to_pdf = False
    result_path = redactor.save(so)
pip install groupdocs-redaction-net
click to copy
copied
More examples Documentation

Meet GroupDocs.Redaction for Python via .NET

GroupDocs.Redaction for Python via .NET helps Python developers easily clean up WORD files. Remove text, images, notes, and metadata with just a few steps.
Learn more
About illustration

Ready to get started?

Download GroupDocs.Redaction for free or get a trial license for full access!

Useful resources

Explore documentation, code samples, and community support to enhance your experience.

Redact Content in WORD Using Python

Use Python tools to clean and protect WORD documents by redacting sensitive text and details.

Temporary license tips

1
Sign up with your work email.
Free mail services are not allowed.
2
Use Get a temporary license button on the second step.
 English