Exemplo n.º 1
0
 protected override void ProcessRecord()
 {
     foreach (var document in AllDocuments("Set-OpenXmlWatermark"))
     {
         try
         {
             if (!(document is WmlDocument))
             {
                 throw new PowerToolsDocumentException("Not a wordprocessing document.");
             }
             OutputDocument(WatermarkAccessor.InsertWatermark((WmlDocument)document, watermarkText, diagonalOrientation));
         }
         catch (Exception e)
         {
             WriteError(PowerToolsExceptionHandling.GetExceptionErrorRecord(e, document));
         }
     }
 }
 /// <summary>
 /// Entry point for PowerShell cmdlets
 /// </summary>
 protected override void ProcessRecord()
 {
     foreach (var document in AllDocuments("Get-OpenXmlWatermark"))
     {
         try
         {
             if (!(document is WmlDocument))
             {
                 throw new PowerToolsDocumentException("Not a wordprocessing document.");
             }
             WriteObject(WatermarkAccessor.GetWatermarkText((WmlDocument)document), true);
         }
         catch (Exception e)
         {
             WriteError(PowerToolsExceptionHandling.GetExceptionErrorRecord(e, document));
         }
     }
 }