public async void ZamenaPic(string textNaZamenu1, StorageFile file) { if (file != null) { using (IRandomAccessStream fileStream = await file.OpenAsync(Windows.Storage.FileAccessMode.Read)) { string textToFind = textNaZamenu1; if (textToFind != null) { RichEditBox richEditBox = new RichEditBox(); richEditBox.Document.SetText(Windows.UI.Text.TextSetOptions.FormatRtf, stringRich); ITextRange searchRange = richEditBox.Document.GetRange(0, 0); if (searchRange.FindText(textToFind, TextConstants.MaxUnitCount, FindOptions.Word) > 0) { await new MessageDialog(searchRange.EndPosition.ToString()).ShowAsync(); // searchRange.SetText(TextSetOptions.FormatRtf, zamena); BitmapImage image = new BitmapImage(); await image.SetSourceAsync(fileStream); searchRange.InsertImage(100, 100, 0, VerticalCharacterAlignment.Baseline, "img", fileStream); } string ss = String.Empty; richEditBox.TextDocument.GetText(Windows.UI.Text.TextGetOptions.FormatRtf, out ss); stringRich = ss; } } } }