/// <summary> /// Insert a picture at the beginning of the paragraph. The graphic must already be loaded into the same document. /// </summary> private void InsertPicture(TemplGraphic graphic, int width) { // Simple. Picture at index(es). Ensure you load picture first. Paragraph.FindAll(Placeholder).ForEach(idx => { if (width > 0) { Paragraph.InsertPicture(graphic.Picture((uint)width), idx + Placeholder.Length); } else { Paragraph.InsertPicture(graphic.Picture(), idx + Placeholder.Length); } Paragraph.Alignment = (graphic.Alignment ?? Paragraph.Alignment); }); }
/// <summary> /// Inserts a picture of a specific pixel width. Aspect ratio is maintained. Matched Picture is removed. /// </summary> private void InsertPicture(TemplGraphic graphic, int width) { if (RemovedPlaceholder || Expired || Removed) { return; } var newPic = graphic.Picture((uint)width); Paragraph.InsertPicture(newPic); Paragraph.Alignment = (graphic.Alignment ?? Paragraph.Alignment); RemovePlaceholder(); Picture = newPic; }