RedactionPolicy

RedactionPolicy class

적용할 특정 교정 세트를 포함하는 삭제 정책을 나타냅니다.

public class RedactionPolicy

생성자

이름 설명
RedactionPolicy() 교정 정책의 새 인스턴스를 생성합니다.
RedactionPolicy(Redaction[]) 특정 교정 목록을 사용하여 교정 정책의 새 인스턴스를 생성합니다.

속성

이름 설명
Redactions { get; } 완전히 구성된 배열을 가져옵니다.Redaction -파생 클래스.

행동 양식

이름 설명
static Load(Stream) 인스턴스 로드RedactionPolicy 스트림에서.
static Load(string) 인스턴스 로드RedactionPolicy 파일 경로에서.
Save(Stream) 스트림에 교정 정책을 저장합니다.
Save(string) 교정 정책을 파일에 저장합니다.

비고

더 알아보기

다음 예는 지정된 인바운드 폴더 내의 모든 파일에 수정 정책을 적용하고 성공적으로 업데이트된 파일과 실패한 파일에 대해 아웃바운드 폴더 중 하나에 저장하는 방법을 보여줍니다.

다음 예제에는 모든 유형의 교정에 대한 샘플 구성이 포함된 샘플 XML 정책 파일이 포함되어 있습니다.

RedactionPolicy policy = RedactionPolicy.Load("RedactionPolicy.xml");
foreach (var fileEntry in Directory.GetFileNames("C:\\Inbound")) 
{
     using (Redactor redactor = new Redactor(Path.Combine("C:\\Inbound\\", fileEntry)))
     {
    	     RedactorChangeLog result = redactor.Apply(policy);
    	     String resultFolder = result.Status != RedactionStatus.Failed ? "C:\\Outbound\\Done\\" : "C:\\Outbound\\Failed\\";
    	     using (Stream fileStream = File.Open(Path.Combine(resultFolder, fileEntry), FileMode.Open, FileAccess.ReadWrite))
   	     {
               redactor.Save(fileStream, new RasterizationOptions() { Enabled = false });
   	     }        
     }
}   
<?xml version="1.0" encoding="utf-8"?>  
<redactionPolicy xmlns = "http://www.groupdocs.com/redaction" >
  <regexRedaction regularExpression="(dolor)" actionType="ReplaceString" replacement="foobar" />  
  <exactPhraseRedaction searchPhrase = "dolor" caseSensitive="true" actionType="DrawBox" color="Red" />   
  
  <cellColumnRedaction regularExpression = "(foo)bar1" replacement="[red1]" columnIndex="1" worksheetIndex="2" /> 
  <cellColumnRedaction regularExpression = "(foo)bar2" replacement="[red2]" wokrsheetName="Sample" /> 
  
  <eraseMetadataRedaction filter = "All" />
  <metadataSearchRedaction filter="Title, Author" replacement="foobar" valueExpression="(metasearch)" keyExpression="" />  
  
 <annotationRedaction regularExpression = "(anno1)" replacement="foobar" />  
 <deleteAnnotationRedaction regularExpression = "(anno2)" />

 <imageAreaRedaction pointX="15" pointY="17" width="200" height="10" color="#AA50FC"  />  
 <imageAreaRedaction pointX = "110" pointY="120" width="60" height="20" color="Magenta"  />  
</redactionPolicy>

또한보십시오