Method RedactToFile
RedactToFile(string, string, OfficeRedactionRequest, OfficeRedactionOptions, CancellationToken)
Redacts the Office document at inputPath and
writes the result to outputPath. The format is
taken from the input path's extension and is preserved in the
output.
public static OfficeRedactionReport RedactToFile(string inputPath, string outputPath, OfficeRedactionRequest request, OfficeRedactionOptions options = null, CancellationToken cancellationToken = default)
Parameters
inputPathstringFile-system path to the source document.
outputPathstringDestination path for the redacted document.
requestOfficeRedactionRequestWhat to redact.
optionsOfficeRedactionOptionsOptional redaction options; defaults are used when
null.cancellationTokenCancellationTokenCancellation token.
Returns
- OfficeRedactionReport
A report describing what was overwritten.
Exceptions
- ArgumentException
Thrown when a path is null or whitespace.
- ArgumentNullException
Thrown when
requestis null.- FileNotFoundException
Thrown when
inputPathdoes not exist.- NotSupportedException
Thrown when the input path's extension names a format other than .docx, .xlsx or .pptx.