Initialize
DocumentFormatInstance.Initialize method
Melakukan inisialisasi instance document format handler.
public virtual void Initialize(DocumentFormatConfiguration config, RedactorSettings settings)
Parameter | Jenis | Keterangan |
---|---|---|
config | DocumentFormatConfiguration | Konfigurasi format |
settings | RedactorSettings | Pengaturan default untuk proses redaksi. |
Contoh
Contoh berikut menunjukkan cara menggunakan data inisialisasi.
public class MyCustomHandler : DocumentFormatInstance
{
private string MyProperty { get; set; }
// Kode khusus lainnya
...
public override void Initialize(DocumentFormatConfiguration config)
{
base.Initialize(config);
if (config.InitializationData.ContainsKey("MyProperty"))
{
MyProperty = config.InitializationData["MyProperty"];
}
}
}
// Memasukkan format khusus ke GroupDocs.Redaction
var mySettings = new DocumentFormatConfiguration();
mySettings.ExtensionFilter = ".foo";
mySettings.DocumentType = typeof(MyCustomHandler);
mySettings.InitializationData.Add("MyProperty", "bar");
var configuration = RedactorConfiguration.GetInstance();
configuration.AvailableFormats.Add(mySettings);
Lihat juga
- class DocumentFormatConfiguration
- class RedactorSettings
- class DocumentFormatInstance
- ruang nama GroupDocs.Redaction.Integration
- perakitan GroupDocs.Redaction