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

Edit or Hide Private Text in DOCX Files with Python

Take control of your DOCX content using GroupDocs.Redaction for Python via .NET and Python. Great for personal or business use.

How to Clean Text in Docx Files

Use GroupDocs.Redaction for Python via .NET inside your Python via .NET apps to remove or hide private text. Fast and simple redaction process.

  1. Create a Redactor and open your Docx file.
  2. Set the redaction rules you want.
  3. Choose the text to find and what to replace it with.
  4. Run redaction and save your new file.
import groupdocs.redaction as gr
import groupdocs.redaction.redactions as grr

# How to redact text in a DOCX file

# Pick your redaction settings
# Enter what to search and what to replace it with
repl_opt = grr.ReplacementOptions("[redacted]")
        
redaction = grr.ExactPhraseRedaction("Text to hide", repl_opt)

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

    # Apply changes and save the updated DOCX file
    result = redactor.apply(redaction)
    redactor.save()
pip install groupdocs-redaction-net
click to copy
copied
More examples Documentation

More Redaction Tools

GroupDocs.Redaction for Python via .NET lets you delete or mask sensitive text across different formats. Share clean and secure files with confidence.

Tools for text, image, and metadata redaction

Find and Replace Private Text

Search for specific words or patterns and swap them out. Works with regular expressions and keyword options.

Cover Sensitive Images

Overlay or hide image areas. Change colors, opacity, and size as needed.

Remove Metadata

Erase hidden info like author names, time stamps, and internal notes to keep your files private.

Use Regex to Redact Patterns

Search for emails, IDs, or patterns using regular expressions and replace them easily.

Python

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

# Set an EMAIL regex pattern 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 the file you want to clean
with gr.Redactor("source.docx") as redactor:

    # Apply your redaction setup
    result = redactor.apply(redaction)

    # Save the redacted document
    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 gives Python developers the tools to clean up content in DOCX files. Redact text, images, comments, and metadata easily.
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 DOCX Using Python

Use Python to remove sensitive text from DOCX files. Keep personal and work documents protected.

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