Controlled cleanup
Inspect before a document leaves the pipeline
Analyze a reviewed medical intake record for protected patient data and hidden review artifacts, choose what the export policy removes, and verify the sanitized document before downloading it.
REVIEWED MEDICAL RECORD
Patient intake and clinical review
DOCX
The synthetic record contains populated patient controls, clinical metadata, reviewer comments, and tracked corrections across a realistic care workflow.
INSPECTION RESULT
Hidden data detected
0Metadata
0Field values
0Comments
0Changes
0Embedded
VERIFICATION
Before and after
AUDITED
Ready to tryUse the controls above to interact with this demo.
What this demonstrates
Make sanitization an auditable pipeline step
A medical record can look ready for exchange while still carrying protected field values, clinician metadata, comments, revision history, or embedded files. Inspecting first makes cleanup measurable and allows an application to apply an explicit export policy.
Key members
Load the source
ServerTextControl.Load
Inspect metadata
ServerTextControl.DocumentSettings
Reset form data
ServerTextControl.FormFields
Remove review data
IFormattedText.Comments
IFormattedText.TrackedChanges
Save the sanitized DOCX
ServerTextControl.Save
Display each state
TXDocumentViewer.loadDocument
How it works
CheckForSanitizableData performs a dry run and returns one report covering metadata, field values, comments, tracked changes, and embedded files. The source document is unchanged.
SanitizeBeforeExport applies only the selected policy categories. Form controls remain in the document while their values are reset; tracked changes are accepted so the visible document is preserved without its revision history.
The same analysis runs again after cleanup. Comparing the reports proves which categories were removed and whether intentionally excluded data remains.
var before = DocumentSanitizer.CheckForSanitizableData(textControl);
var result = DocumentSanitizer.SanitizeBeforeExport(textControl, policy);
textControl.Save(out byte[] document, BinaryStreamType.WordprocessingML);
Technique adapted from Sanitizing Data in Document Pipelines.
NuGet packages
TXTextControl.TextControl.Core.SDK
34.0.4
Provides the core document model and server-side document processing APIs.
dotnet add package TXTextControl.TextControl.Core.SDK --version 34.0.4
Displays supported document and PDF formats in the browser.
dotnet add package TXTextControl.Web.DocumentViewer --version 34.2.0