Просмотр исходного кода

Fixed parameter check newValue for Replace to be only checked for null. Having an empty string is allowed as replacement value.

master
MadBoy_cp 12 лет назад
Родитель
Сommit
8794300fd3
1 измененных файлов: 1 добавлений и 2 удалений
  1. 1
    2
      DocX/Container.cs

+ 1
- 2
DocX/Container.cs Просмотреть файл

public virtual void ReplaceText(string oldValue, string newValue, bool trackChanges = false, RegexOptions options = RegexOptions.None, Formatting newFormatting = null, Formatting matchFormatting = null, MatchFormattingOptions fo = MatchFormattingOptions.SubsetMatch) public virtual void ReplaceText(string oldValue, string newValue, bool trackChanges = false, RegexOptions options = RegexOptions.None, Formatting newFormatting = null, Formatting matchFormatting = null, MatchFormattingOptions fo = MatchFormattingOptions.SubsetMatch)
{ {
// PATCH BY HeDo - Arguments check!
if (oldValue == null || oldValue.Length == 0) if (oldValue == null || oldValue.Length == 0)
throw new ArgumentException("oldValue cannot be null or empty", "oldValue"); throw new ArgumentException("oldValue cannot be null or empty", "oldValue");
if (newValue == null || newValue.Length == 0)
if (newValue == null)
throw new ArgumentException("newValue cannot be null or empty", "newValue"); throw new ArgumentException("newValue cannot be null or empty", "newValue");
// ReplaceText in Headers of the document. // ReplaceText in Headers of the document.
Headers headers = Document.Headers; Headers headers = Document.Headers;

Загрузка…
Отмена
Сохранить