• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# OpenXmlPart类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中OpenXmlPart的典型用法代码示例。如果您正苦于以下问题:C# OpenXmlPart类的具体用法?C# OpenXmlPart怎么用?C# OpenXmlPart使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



OpenXmlPart类属于命名空间,在下文中一共展示了OpenXmlPart类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: OpenXmlPartRootElement

        /// <summary>
        /// Initializes a new instance of the OpenXmlPartRootElement class using the supplied OpenXmlPart.
        /// </summary>
        /// <param name="openXmlPart">The OpenXmlPart class.</param>
        protected OpenXmlPartRootElement(OpenXmlPart openXmlPart)
        {
            if (openXmlPart == null)
            {
                throw new ArgumentNullException("openXmlPart");
            }

            this._elementContext = new OpenXmlElementContext();
            LoadFromPart(openXmlPart);
        }
开发者ID:eriawan,项目名称:Open-XML-SDK,代码行数:14,代码来源:OpenXmlPartRootElement.cs


示例2: ImageData

 public ImageData(OpenXmlPart contentPart, ImagePart part)
 {
     ContentType = part.ContentType;
     ContentPart = contentPart;
     using (Stream s = part.GetStream(FileMode.Open, FileAccess.Read))
     {
         Image = new byte[s.Length];
         s.Read(Image, 0, (int)s.Length);
     }
 }
开发者ID:mvlasenko,项目名称:TridionDesktopTools,代码行数:10,代码来源:DocumentBuilder.cs


示例3: LoadPart

        private XDocument LoadPart(OpenXmlPart source)
	    {
		    if (source == null) return null;

			var part = source.Annotation<XDocument>();
		    if (part != null) return part;

		    using (var str = source.GetStream())
		    using (var streamReader = new StreamReader(str))
		    using (var xr = XmlReader.Create(streamReader))
			    part = XDocument.Load(xr);
		    return part;
	    }
开发者ID:BorisVaskin,项目名称:TemplateEngine.Docx,代码行数:13,代码来源:TemplateProcessor.cs


示例4: ProcessTemplatePart

        private static void ProcessTemplatePart(XElement data, TemplateError te, OpenXmlPart part)
        {
            XDocument xDoc = part.GetXDocument();

            XElement newRootElementWithMetadata = (XElement)TransformToMetadata(xDoc.Root, data, te);

            NormalizeTablesRepeatAndConditional(newRootElementWithMetadata, te);
            XElement newRootElement = newRootElementWithMetadata;

            // do the actual content replacement
            newRootElement = (XElement)ContentReplacementTransform(newRootElement, data, te);

            xDoc.Elements().First().ReplaceWith(newRootElement);
            part.PutXDocument();
            return;
        }
开发者ID:BogdanDamianC,项目名称:Open-Xml-PowerTools,代码行数:16,代码来源:DocumentAssembler.cs


示例5: WriteElementToCustomXmlPart

        /// <summary>
        /// Writes the element to custom XML part.
        /// </summary>
        /// <param name="customXmlPart">The custom XML part.</param>
        /// <param name="rootElement">The root element.</param>
        public static void WriteElementToCustomXmlPart(OpenXmlPart customXmlPart, XNode rootElement)
        {
            if (customXmlPart == null)
            {
                throw new ArgumentNullException("customXmlPart");
            }

            if (rootElement == null)
            {
                throw new ArgumentNullException("rootElement");
            }

            using (var writer = XmlWriter.Create(customXmlPart.GetStream(FileMode.Create, FileAccess.Write)))
            {
                rootElement.WriteTo(writer);
                writer.Flush();
            }
        }
开发者ID:nagyist,项目名称:BuildManager,代码行数:23,代码来源:CustomXmlPartCore.cs


示例6: FlushPart

 private static void FlushPart(OpenXmlPart part, HashSet<OpenXmlPart> visited)
 {
     visited.Add(part);
     XDocument xdoc = part.Annotation<XDocument>();
     if (xdoc != null && xdoc.Annotation<ChangedSemaphore>() != null)
     {
         using (XmlWriter xw = XmlWriter.Create(part.GetStream(FileMode.Create, FileAccess.Write)))
         {
             xdoc.Save(xw);
         }
         xdoc.RemoveAnnotations<ChangedSemaphore>();
         xdoc.Changing += ElementChanged;
         xdoc.Changed += ElementChanged;
     }
     foreach (IdPartPair item in part.Parts)
         if (!visited.Contains(item.OpenXmlPart))
             FlushPart(item.OpenXmlPart, visited);
 }
开发者ID:huamouse,项目名称:Taoqi,代码行数:18,代码来源:DocumentExtensions.cs


示例7: AcceptRevisionsForPart

 public static void AcceptRevisionsForPart(OpenXmlPart part)
 {
     XElement documentElement = part.GetXDocument().Root;
     documentElement = (XElement)AcceptMoveFromMoveToTransform(documentElement);
     documentElement = AcceptMoveFromRanges(documentElement);
     // AcceptParagraphEndTagsInMoveFromTransform needs rewritten similar to AcceptDeletedAndMoveFromParagraphMarks
     documentElement = (XElement)AcceptParagraphEndTagsInMoveFromTransform(documentElement);
     documentElement = AcceptDeletedAndMovedFromContentControls(documentElement);
     documentElement = AcceptDeletedAndMoveFromParagraphMarks(documentElement);
     documentElement = (XElement)RemoveRowsLeftEmptyByMoveFrom(documentElement);
     documentElement = (XElement)AcceptAllOtherRevisionsTransform(documentElement);
     documentElement = (XElement)AcceptDeletedCellsTransform(documentElement);
     documentElement = (XElement)MergeAdjacentTablesTransform(documentElement);
     documentElement.Descendants().Attributes().Where(a => a.Name == PT.UniqueId || a.Name == PT.RunIds).Remove();
     documentElement.Descendants(W.numPr).Where(np => !np.HasElements).Remove();
     XDocument newXDoc = new XDocument(documentElement);
     part.PutXDocument(newXDoc);
 }
开发者ID:eriawan,项目名称:Open-XML-SDK,代码行数:18,代码来源:RevisionAccepter.cs


示例8: PartHasTrackedRevisions

 public bool PartHasTrackedRevisions(OpenXmlPart part)
 {
     XmlDocument doc = GetXmlDocument(part);
     string wordNamespace =
         "http://schemas.openxmlformats.org/wordprocessingml/2006/main";
     XmlNamespaceManager nsmgr =
         new XmlNamespaceManager(doc.NameTable);
     nsmgr.AddNamespace("w", wordNamespace);
     string xpathExpression =
         "descendant::w:cellDel|" +
         "descendant::w:cellIns|" +
         "descendant::w:cellMerge|" +
         "descendant::w:customXmlDelRangeEnd|" +
         "descendant::w:customXmlDelRangeStart|" +
         "descendant::w:customXmlInsRangeEnd|" +
         "descendant::w:customXmlInsRangeStart|" +
         "descendant::w:del|" +
         "descendant::w:delInstrText|" +
         "descendant::w:delText|" +
         "descendant::w:ins|" +
         "descendant::w:moveFrom|" +
         "descendant::w:moveFromRangeEnd|" +
         "descendant::w:moveFromRangeStart|" +
         "descendant::w:moveTo|" +
         "descendant::w:moveToRangeEnd|" +
         "descendant::w:moveToRangeStart|" +
         "descendant::w:moveTo|" +
         "descendant::w:numberingChange|" +
         "descendant::w:rPrChange|" +
         "descendant::w:pPrChange|" +
         "descendant::w:rPrChange|" +
         "descendant::w:sectPrChange|" +
         "descendant::w:tcPrChange|" +
         "descendant::w:tblGridChange|" +
         "descendant::w:tblPrChange|" +
         "descendant::w:tblPrExChange|" +
         "descendant::w:trPrChange";
     XmlNodeList descendants = doc.SelectNodes(xpathExpression, nsmgr);
     return descendants.Count > 0;
 }
开发者ID:oghenez,项目名称:trade-software,代码行数:40,代码来源:WordAnalysis.cs


示例9: Create

 /// <summary>
 /// Creates an OpenXmlReader from the specified OpenXmlPart and Boolean values.
 /// </summary>
 /// <param name="openXmlPart">The OpenXmlPart to read.</param>
 /// <param name="readMiscNodes">Specify false to indicate to the reader to skip all miscellaneous nodes. The default value is false.</param>
 /// <returns>The newly created OpenXmlReader.</returns>
 public static OpenXmlReader Create(OpenXmlPart openXmlPart, bool readMiscNodes)
 {
     return new OpenXmlPartReader(openXmlPart, readMiscNodes);
 }
开发者ID:ErykJaroszewicz,项目名称:Open-XML-SDK,代码行数:10,代码来源:OpenXmlReader.cs


示例10: XmlPath

 /// <summary>
 /// Initlizes a new instance of the XmlPath from the specified OpenXmlPart.
 /// </summary>
 /// <param name="part">The OpenXmlPart.</param>
 internal XmlPath(OpenXmlPart part)
 {
     Debug.Assert(part != null);
     this.PartUri = part.Uri;
 }
开发者ID:eriawan,项目名称:Open-XML-SDK,代码行数:9,代码来源:XmlPath.cs


示例11: OpenXmlPartReader

 /// <summary>
 /// Initializes a new instance of the OpenXmlPartReader class using the supplied OpenXmlPart and Boolean values.
 /// </summary>
 /// <param name="openXmlPart">The OpenXmlPart to read.</param>
 /// <param name="readMiscNodes">Specify false to indicate to the reader to skip all miscellaneous nodes. The default value is false.</param>
 public OpenXmlPartReader(OpenXmlPart openXmlPart, bool readMiscNodes)
     : this(readMiscNodes)
 {
     if (openXmlPart == null)
     {
         throw new ArgumentNullException("openXmlPart");
     }
     // set MaxCharactersInDocument to limit the part size on loading DOM.
     this._elementContext.XmlReaderSettings.MaxCharactersInDocument = openXmlPart.MaxCharactersInPart;
     Stream partStream = openXmlPart.GetStream(FileMode.Open);
     this.Init(partStream, /*closeInput*/true);
 }
开发者ID:ErykJaroszewicz,项目名称:Open-XML-SDK,代码行数:17,代码来源:OpenXmlReader.cs


示例12: GenerateImagePart

 private static void GenerateImagePart(OpenXmlPart part, byte[] imageFileBytes)
 {
     // Write the contents of the image to the ImagePart.
     using (BinaryWriter writer = new BinaryWriter(part.GetStream()))
     {
         writer.Write(imageFileBytes);
         writer.Flush();
     }
 }
开发者ID:cristianowa,项目名称:Visual-Studio-Projects,代码行数:9,代码来源:SlideShowCreator.cs


示例13: AddPart

 private static void AddPart(HashSet<OpenXmlPart> partList, OpenXmlPart part)
 {
     if (partList.Contains(part))
         return;
     partList.Add(part);
     foreach (IdPartPair p in part.Parts)
         AddPart(partList, p.OpenXmlPart);
 }
开发者ID:BogdanDamianC,项目名称:Open-Xml-PowerTools,代码行数:8,代码来源:PtOpenXmlUtil.cs


示例14: AddContentPartRelTypeResourceIdTupple

 public void AddContentPartRelTypeResourceIdTupple(OpenXmlPart contentPart, string relationshipType, string relationshipId)
 {
     ContentPartRelTypeIdList.Add(
         new ContentPartRelTypeIdTuple()
         {
             ContentPart = contentPart,
             RelationshipType = relationshipType,
             RelationshipId = relationshipId,
         });
 }
开发者ID:BogdanDamianC,项目名称:Open-Xml-PowerTools,代码行数:10,代码来源:PtOpenXmlUtil.cs


示例15: MergeCommentsInPart

        private static void MergeCommentsInPart(OpenXmlPart part1, OpenXmlPart part2, 
            OpenXmlPart destinationPart, XDocument commentsPartXDoc)
        {
            XDocument xdoc1 = part1.GetXDocument();
            XDocument xdoc2 = part2.GetXDocument();

            XElement newRootElement = (XElement)MergeElementTransform(xdoc1.Root, xdoc2.Root, 
                commentsPartXDoc);
            destinationPart.PutXDocument(new XDocument(newRootElement));
        }
开发者ID:jecabana,项目名称:Portal-Vanity-Daniel-en-stand-by,代码行数:10,代码来源:CommentMerger.cs


示例16: FixIdsInPart

 // todo are there any other elements that need ids fixed?  see children of paragraph, run
 private static void FixIdsInPart(OpenXmlPart part, int nextCommentId, int nextBookmarkId)
 {
     if (part == null)
         return;
     foreach (var element in part.GetXDocument().Root.Descendants()
         .Where(e => e.Name == W.commentRangeStart ||
             e.Name == W.commentRangeEnd || 
             e.Name == W.commentReference))
         element.Attribute(W.id).Value = ((int)element.Attribute(W.id) + nextCommentId).ToString();
     foreach (var element in part.GetXDocument().Root.Descendants()
         .Where(e => e.Name == W.bookmarkStart || e.Name == W.bookmarkEnd))
         element.Attribute(W.id).Value = ((int)element.Attribute(W.id) + nextBookmarkId).ToString();
 }
开发者ID:jecabana,项目名称:Portal-Vanity-Daniel-en-stand-by,代码行数:14,代码来源:CommentMerger.cs


示例17: TestPartForUnsupportedContent

 private static void TestPartForUnsupportedContent(OpenXmlPart part, int sourceNumber)
 {
     XNamespace[] obsoleteNamespaces = new[]
         {
             XNamespace.Get("http://schemas.microsoft.com/office/word/2007/5/30/wordml"),
             XNamespace.Get("http://schemas.microsoft.com/office/word/2008/9/16/wordprocessingDrawing"),
             XNamespace.Get("http://schemas.microsoft.com/office/word/2009/2/wordml"),
         };
     XDocument xDoc = part.GetXDocument();
     XElement invalidElement = xDoc.Descendants()
         .FirstOrDefault(d =>
             {
                 bool b = d.Name == W.subDoc ||
                     d.Name == W.control ||
                     d.Name == W.altChunk ||
                     d.Name.LocalName == "contentPart" ||
                     obsoleteNamespaces.Contains(d.Name.Namespace);
                 bool b2 = b ||
                     d.Attributes().Any(a => obsoleteNamespaces.Contains(a.Name.Namespace));
                 return b2;
             });
     if (invalidElement != null)
     {
         if (invalidElement.Name == W.subDoc)
             throw new DocumentBuilderException(String.Format("Source {0} is unsupported document - contains sub document",
                 sourceNumber));
         if (invalidElement.Name == W.control)
             throw new DocumentBuilderException(String.Format("Source {0} is unsupported document - contains ActiveX controls",
                 sourceNumber));
         if (invalidElement.Name == W.altChunk)
             throw new DocumentBuilderException(String.Format("Source {0} is unsupported document - contains altChunk",
                 sourceNumber));
         if (invalidElement.Name.LocalName == "contentPart")
             throw new DocumentBuilderException(String.Format("Source {0} is unsupported document - contains contentPart content",
                 sourceNumber));
         if (obsoleteNamespaces.Contains(invalidElement.Name.Namespace) ||
             invalidElement.Attributes().Any(a => obsoleteNamespaces.Contains(a.Name.Namespace)))
             throw new DocumentBuilderException(String.Format("Source {0} is unsupported document - contains obsolete namespace",
                 sourceNumber));
     }
 }
开发者ID:jecabana,项目名称:Portal-Vanity-Daniel-en-stand-by,代码行数:41,代码来源:DocumentBuilder.cs


示例18: AddRelationships

 private static void AddRelationships(OpenXmlPart oldPart, OpenXmlPart newPart, IEnumerable<XElement> newContent)
 {
     var relevantElements = newContent.DescendantsAndSelf()
         .Where(d => RelationshipMarkup.ContainsKey(d.Name) &&
             d.Attributes().Any(a => RelationshipMarkup[d.Name].Contains(a.Name)))
         .ToList();
     foreach (var e in relevantElements)
     {
         if (e.Name == W.hyperlink)
         {
             string relId = (string)e.Attribute(R.id);
             if (string.IsNullOrEmpty(relId))
                 continue;
             var tempHyperlink = newPart.HyperlinkRelationships.FirstOrDefault(h => h.Id == relId);
             if (tempHyperlink != null)
                 continue;
             Guid g = Guid.NewGuid();
             string newRid = "R" + g.ToString().Replace("-", "");
             var oldHyperlink = oldPart.HyperlinkRelationships.FirstOrDefault(h => h.Id == relId);
             if (oldHyperlink == null)
                 continue;
             //throw new DocumentBuilderInternalException("Internal Error 0002");
             newPart.AddHyperlinkRelationship(oldHyperlink.Uri, oldHyperlink.IsExternal, newRid);
             UpdateContent(newContent, e.Name, relId, newRid);
         }
         if (e.Name == W.attachedTemplate || e.Name == W.saveThroughXslt)
         {
             string relId = (string)e.Attribute(R.id);
             if (string.IsNullOrEmpty(relId))
                 continue;
             var tempExternalRelationship = newPart.ExternalRelationships.FirstOrDefault(h => h.Id == relId);
             if (tempExternalRelationship != null)
                 continue;
             Guid g = Guid.NewGuid();
             string newRid = "R" + g.ToString().Replace("-", "");
             var oldRel = oldPart.ExternalRelationships.FirstOrDefault(h => h.Id == relId);
             if (oldRel == null)
                 throw new DocumentBuilderInternalException("Source {0} is invalid document - hyperlink contains invalid references");
             newPart.AddExternalRelationship(oldRel.RelationshipType, oldRel.Uri, newRid);
             UpdateContent(newContent, e.Name, relId, newRid);
         }
         if (e.Name == A.hlinkClick)
         {
             string relId = (string)e.Attribute(R.id);
             if (string.IsNullOrEmpty(relId))
                 continue;
             var tempHyperlink = newPart.HyperlinkRelationships.FirstOrDefault(h => h.Id == relId);
             if (tempHyperlink != null)
                 continue;
             Guid g = Guid.NewGuid();
             string newRid = "R" + g.ToString().Replace("-", "");
             var oldHyperlink = oldPart.HyperlinkRelationships.FirstOrDefault(h => h.Id == relId);
             if (oldHyperlink == null)
                 continue;
             newPart.AddHyperlinkRelationship(oldHyperlink.Uri, oldHyperlink.IsExternal, newRid);
             UpdateContent(newContent, e.Name, relId, newRid);
         }
         if (e.Name == VML.imagedata)
         {
             string relId = (string)e.Attribute(R.href);
             if (string.IsNullOrEmpty(relId))
                 continue;
             var tempExternalRelationship = newPart.ExternalRelationships.FirstOrDefault(h => h.Id == relId);
             if (tempExternalRelationship != null)
                 continue;
             Guid g = Guid.NewGuid();
             string newRid = "R" + g.ToString().Replace("-", "");
             var oldRel = oldPart.ExternalRelationships.FirstOrDefault(h => h.Id == relId);
             if (oldRel == null)
                 throw new DocumentBuilderInternalException("Internal Error 0006");
             newPart.AddExternalRelationship(oldRel.RelationshipType, oldRel.Uri, newRid);
             UpdateContent(newContent, e.Name, relId, newRid);
         }
         if (e.Name == A.blip)
         {
             string relId = (string)e.Attribute(R.link);
             if (string.IsNullOrEmpty(relId))
                 continue;
             var tempExternalRelationship = newPart.ExternalRelationships.FirstOrDefault(h => h.Id == relId);
             if (tempExternalRelationship != null)
                 continue;
             Guid g = Guid.NewGuid();
             string newRid = "R" + g.ToString().Replace("-", "");
             var oldRel = oldPart.ExternalRelationships.FirstOrDefault(h => h.Id == relId);
             if (oldRel == null)
                 continue;
             newPart.AddExternalRelationship(oldRel.RelationshipType, oldRel.Uri, newRid);
             UpdateContent(newContent, e.Name, relId, newRid);
         }
     }
 }
开发者ID:jecabana,项目名称:Portal-Vanity-Daniel-en-stand-by,代码行数:91,代码来源:DocumentBuilder.cs


示例19: CopyRelatedPartsForContentParts

        private static void CopyRelatedPartsForContentParts(OpenXmlPart oldContentPart, OpenXmlPart newContentPart,
            IEnumerable<XElement> newContent, List<ImageData> images)
        {
            var relevantElements = newContent.DescendantsAndSelf()
                .Where(d => d.Name == VML.imagedata || d.Name == VML.fill || d.Name == VML.stroke || d.Name == A.blip)
                .ToList();
            foreach (XElement imageReference in relevantElements)
            {
                CopyRelatedImage(oldContentPart, newContentPart, imageReference, R.embed, images);
                CopyRelatedImage(oldContentPart, newContentPart, imageReference, R.pict, images);
                CopyRelatedImage(oldContentPart, newContentPart, imageReference, R.id, images);
            }

            foreach (XElement diagramReference in newContent.DescendantsAndSelf().Where(d => d.Name == DGM.relIds || d.Name == A.relIds))
            {
                // dm attribute
                string relId = diagramReference.Attribute(R.dm).Value;
                try
                {
                    OpenXmlPart tempPart = newContentPart.GetPartById(relId);
                    continue;
                }
                catch (ArgumentOutOfRangeException)
                {
                    try
                    {
                        ExternalRelationship tempEr = newContentPart.GetExternalRelationship(relId);
                        continue;
                    }
                    catch (KeyNotFoundException)
                    {
                    }
                }
                OpenXmlPart oldPart = oldContentPart.GetPartById(relId);
                OpenXmlPart newPart = newContentPart.AddNewPart<DiagramDataPart>();
                newPart.GetXDocument().Add(oldPart.GetXDocument().Root);
                diagramReference.Attribute(R.dm).Value = newContentPart.GetIdOfPart(newPart);
                AddRelationships(oldPart, newPart, new[] { newPart.GetXDocument().Root });
                CopyRelatedPartsForContentParts(oldPart, newPart, new[] { newPart.GetXDocument().Root }, images);

                // lo attribute
                relId = diagramReference.Attribute(R.lo).Value;
                try
                {
                    OpenXmlPart tempPart = newContentPart.GetPartById(relId);
                    continue;
                }
                catch (ArgumentOutOfRangeException)
                {
                    try
                    {
                        ExternalRelationship tempEr = newContentPart.GetExternalRelationship(relId);
                        continue;
                    }
                    catch (KeyNotFoundException)
                    {
                    }
                }
                oldPart = oldContentPart.GetPartById(relId);
                newPart = newContentPart.AddNewPart<DiagramLayoutDefinitionPart>();
                newPart.GetXDocument().Add(oldPart.GetXDocument().Root);
                diagramReference.Attribute(R.lo).Value = newContentPart.GetIdOfPart(newPart);
                AddRelationships(oldPart, newPart, new[] { newPart.GetXDocument().Root });
                CopyRelatedPartsForContentParts(oldPart, newPart, new[] { newPart.GetXDocument().Root }, images);

                // qs attribute
                relId = diagramReference.Attribute(R.qs).Value;
                try
                {
                    OpenXmlPart tempPart = newContentPart.GetPartById(relId);
                    continue;
                }
                catch (ArgumentOutOfRangeException)
                {
                    try
                    {
                        ExternalRelationship tempEr = newContentPart.GetExternalRelationship(relId);
                        continue;
                    }
                    catch (KeyNotFoundException)
                    {
                    }
                }
                oldPart = oldContentPart.GetPartById(relId);
                newPart = newContentPart.AddNewPart<DiagramStylePart>();
                newPart.GetXDocument().Add(oldPart.GetXDocument().Root);
                diagramReference.Attribute(R.qs).Value = newContentPart.GetIdOfPart(newPart);
                AddRelationships(oldPart, newPart, new[] { newPart.GetXDocument().Root });
                CopyRelatedPartsForContentParts(oldPart, newPart, new[] { newPart.GetXDocument().Root }, images);

                // cs attribute
                relId = diagramReference.Attribute(R.cs).Value;
                try
                {
                    OpenXmlPart tempPart = newContentPart.GetPartById(relId);
                    continue;
                }
                catch (ArgumentOutOfRangeException)
                {
                    try
//.........这里部分代码省略.........
开发者ID:jecabana,项目名称:Portal-Vanity-Daniel-en-stand-by,代码行数:101,代码来源:DocumentBuilder.cs


示例20: ManageImageCopy

 // General function for handling images that tries to use an existing image if they are the same
 private static ImageData ManageImageCopy(ImagePart oldImage, OpenXmlPart newContentPart, List<ImageData> images)
 {
     ImageData oldImageData = new ImageData(newContentPart, oldImage);
     foreach (ImageData item in images)
     {
         if (newContentPart != item.ContentPart)
             continue;
         if (item.Compare(oldImageData))
             return item;
     }
     images.Add(oldImageData);
     return oldImageData;
 }
开发者ID:jecabana,项目名称:Portal-Vanity-Daniel-en-stand-by,代码行数:14,代码来源:DocumentBuilder.cs



注:本文中的OpenXmlPart类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# OpenedFile类代码示例发布时间:2022-05-24
下一篇:
C# OpenXmlElement类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap