I have a picture of internet . I want save it in special part of word .
I find special part with this code .
XNamespace w =
"http://schemas.openxmlformats.org/wordprocessingml/2006/main";
XNamespace r =
"http://schemas.openxmlformats.org/officeDocument/2006/relationships";
MainDocumentPart mainPart = wordDoc.MainDocumentPart;
XDocument mainDocumentXDoc = GetXDocument(wordDoc);
var q1 = mainDocumentXDoc
.Root
.Element(w + "body")
.Elements();
// project collection of tuples containing element and type
var q2 = q1
.Select(s =>
{
string keyForGroupAdjacent = ".NonContentControl";
if (s.Name == w + "sdt")
keyForGroupAdjacent = (s.Element(w + "sdtPr").Element(w + "tag") != null) ? s.Element(w + "sdtPr").Element(w + "tag").Attribute(w + "val").Value : "";
if (s.Name == w + "sectPr")
keyForGroupAdjacent = null;
return new
{
Element = s,
KeyForGroupAdjacent = keyForGroupAdjacent
};
}
).Where(s => s.KeyForGroupAdjacent != null);
foreach (var item in q2)
{
if (item.Element.Value == "[متن]")
{
item.Element.AddFirst(**Picture**);
break;
}
}
Who do add this picture in item ?