GroupDocs.Watermarkを使用して柔軟な検出ルールで埋め込まれた透かしコンテンツを文書内で検索する方法を見てみましょう。
Python
import groupdocs.watermark as gw
import groupdocs.watermark.search.searchcriteria as gwss
import groupdocs.watermark.options.spreadsheet as gwos
# ディスクまたはストリームからターゲット文書を開く
load_options = gwos.SpreadsheetLoadOptions()
with gw.Watermarker("source.xlsx", load_options) as watermarker:
# 検索に使用する具体的な透かしの属性を定義する
criteria = gwss.TextFormattingSearchCriteria()
criteria.foreground_color_range = gwss.ColorRange()
criteria.foreground_color_range.min_hue = -5.0
criteria.foreground_color_range.max_hue = 10.0
criteria.foreground_color_range.min_brightness = 0.01
criteria.foreground_color_range.max_brightness = 0.99
criteria.background_color_range = gwss.ColorRange()
criteria.background_color_range.is_empty = True
criteria.font_name = "Arial"
criteria.min_font_size = 19.0
criteria.max_font_size = 42.0
criteria.font_bold = True
# 検索を実行し、一致を収集する
possible_watermarks = watermarker.search(criteria)
# 見つかった結果を操作してあらゆるアクションを行う
print("Found {0} possible watermark(s).".format(len(possible_watermarks)))