예제 #1
0
        public static void CopyRelativeElements(this OpenXmlElement element, WordprocessingDocument weekDoc, MainDocumentPart fromPart)
        {
            //images
            element.Descendants <DocumentFormat.OpenXml.Drawing.Blip>().ToList()
            .ForEach(blip =>
            {
                var newRelation = weekDoc.CopyImagePart(blip.Embed, fromPart);
                blip.Embed      = newRelation;
            });

            element.Descendants <DocumentFormat.OpenXml.Vml.ImageData>().ToList()
            .ForEach(imageData =>
            {
                var newRelation          = weekDoc.CopyImagePart(imageData.RelationshipId, fromPart);
                imageData.RelationshipId = newRelation;
            });
        }