当前位置: 首页>>代码示例>>C#>>正文


C# OPC.PackageRelationship类代码示例

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


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

示例1: CommentsTable

        internal CommentsTable(PackagePart part, PackageRelationship rel)
            : base(part, rel)
        {

            XmlDocument xml = ConvertStreamToXml(part.GetInputStream());
            ReadFrom(xml);
        }
开发者ID:89sos98,项目名称:npoi,代码行数:7,代码来源:CommentsTable.cs

示例2: POIXMLDocumentPart

        /**
         * Construct POIXMLDocumentPart representing a "core document" namespace part.
         */
        public POIXMLDocumentPart(OPCPackage pkg)
        {
            PackageRelationship coreRel = pkg.GetRelationshipsByType(PackageRelationshipTypes.CORE_DOCUMENT).GetRelationship(0);

            this.packagePart = pkg.GetPart(coreRel);
            this.packageRel = coreRel;
        }
开发者ID:eatage,项目名称:npoi,代码行数:10,代码来源:POIXMLDocumentPart.cs

示例3: CreateDocumentPart

        public override POIXMLDocumentPart CreateDocumentPart(POIXMLDocumentPart parent, PackageRelationship rel, PackagePart part)
        {
            POIXMLRelation descriptor = XWPFRelation.GetInstance(rel.RelationshipType);
            if (descriptor == null || descriptor.RelationClass == null)
            {
                logger.Log(POILogger.DEBUG, "using default POIXMLDocumentPart for " + rel.RelationshipType);
                return new POIXMLDocumentPart(part, rel);
            }

            try
            {
                Type cls = descriptor.RelationClass;
                try
                {
                    ConstructorInfo constructor = cls.GetConstructor(new Type[] { typeof(POIXMLDocumentPart), typeof(PackagePart), typeof(PackageRelationship) });
                    return constructor.Invoke(new object[] { parent, part, rel }) as POIXMLDocumentPart;
                }
                catch (Exception)
                {
                    ConstructorInfo constructor = cls.GetConstructor(new Type[] { typeof(PackagePart), typeof(PackageRelationship) });
                    return constructor.Invoke(new object[] { part, rel }) as POIXMLDocumentPart;
                }
            }
            catch (Exception e)
            {
                throw new POIXMLException(e);
            }
        }
开发者ID:JnS-Software-LLC,项目名称:npoi,代码行数:28,代码来源:XWPFFactory.cs

示例4: XSSFChart

        /**
         * Construct a SpreadsheetML chart from a namespace part.
         *
         * @param part the namespace part holding the chart data,
         * the content type must be <code>application/vnd.Openxmlformats-officedocument.Drawingml.chart+xml</code>
         * @param rel  the namespace relationship holding this chart,
         * the relationship type must be http://schemas.Openxmlformats.org/officeDocument/2006/relationships/chart
         */
        protected XSSFChart(PackagePart part, PackageRelationship rel)
            : base(part, rel)
        {

            XmlDocument doc = ConvertStreamToXml(part.GetInputStream());
            chartSpaceDocument = ChartSpaceDocument.Parse(doc, NamespaceManager);
            chart = chartSpaceDocument.GetChartSpace().chart;
        }
开发者ID:eatage,项目名称:npoi,代码行数:16,代码来源:XSSFChart.cs

示例5: XSSFChart

        /**
         * Construct a SpreadsheetML chart from a namespace part.
         *
         * @param part the namespace part holding the chart data,
         * the content type must be <code>application/vnd.Openxmlformats-officedocument.Drawingml.chart+xml</code>
         * @param rel  the namespace relationship holding this chart,
         * the relationship type must be http://schemas.Openxmlformats.org/officeDocument/2006/relationships/chart
         */
        protected XSSFChart(PackagePart part, PackageRelationship rel)
            : base(part, rel)
        {


            chartSpace = ChartSpaceDocument.Parse(part.GetInputStream()).GetChartSpace();
            chart = chartSpace.chart;
        }
开发者ID:WPG,项目名称:npoi,代码行数:16,代码来源:XSSFChart.cs

示例6: XSSFDrawing

 /**
  * Construct a SpreadsheetML Drawing from a namespace part
  *
  * @param part the namespace part holding the Drawing data,
  * the content type must be <code>application/vnd.openxmlformats-officedocument.Drawing+xml</code>
  * @param rel  the namespace relationship holding this Drawing,
  * the relationship type must be http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing
  */
 internal XSSFDrawing(PackagePart part, PackageRelationship rel)
     : base(part, rel)
 {
     //XmlOptions options = new XmlOptions(DEFAULT_XML_OPTIONS);
     ////Removing root element
     //options.setLoadReplaceDocumentElement(null);
     //drawing = CTDrawing.Factory.parse(part.getInputStream(), options);
     drawing = NPOI.OpenXmlFormats.Dml.Spreadsheet.CT_Drawing.Parse(part.GetInputStream());
 }
开发者ID:kenlen,项目名称:npoi,代码行数:17,代码来源:XSSFDrawing.cs

示例7: GetTargetPart

 /**
  * Get the PackagePart that is the target of a relationship.
  *
  * @param rel The relationship
  * @param pkg The namespace to fetch from
  * @return The target part
  * @throws InvalidFormatException
  */
 protected static PackagePart GetTargetPart(OPCPackage pkg, PackageRelationship rel)
  {
     PackagePartName relName = PackagingUriHelper.CreatePartName(rel.TargetUri);
     PackagePart part = pkg.GetPart(relName);
     if (part == null) {
         throw new ArgumentException("No part found for relationship " + rel);
     }
     return part;
 }
开发者ID:hanwangkun,项目名称:npoi,代码行数:17,代码来源:POIXMLDocumentPart.cs

示例8: XSSFHyperlink

        /**
         * Create a XSSFHyperlink amd Initialize it from the supplied CTHyperlink bean and namespace relationship
         *
         * @param ctHyperlink the xml bean Containing xml properties
         * @param hyperlinkRel the relationship in the underlying OPC namespace which stores the actual link's Address
         */
        public XSSFHyperlink(CT_Hyperlink ctHyperlink, PackageRelationship hyperlinkRel)
        {
            _ctHyperlink = ctHyperlink;
            _externalRel = hyperlinkRel;

            // Figure out the Hyperlink type and distination

            // If it has a location, it's internal
            if (ctHyperlink.location != null)
            {
                _type = HyperlinkType.Document;
                _location = ctHyperlink.location;
            }
            else
            {
                // Otherwise it's somehow external, check
                //  the relation to see how
                if (_externalRel == null)
                {
                    if (ctHyperlink.id != null)
                    {
                        throw new InvalidOperationException("The hyperlink for cell " +
                            [email protected] + " references relation " + ctHyperlink.id + ", but that didn't exist!");
                    }
                    // hyperlink is internal and is not related to other parts
                    _type = HyperlinkType.Document;
                }
                else
                {
                    Uri target = _externalRel.TargetUri;
                    try
                    {
                        _location = target.ToString();
                    }
                    catch (UriFormatException)
                    {
                        _location = target.OriginalString;
                    }

                    // Try to figure out the type
                    if (_location.StartsWith("http://") || _location.StartsWith("https://")
                            || _location.StartsWith("ftp://"))
                    {
                        _type = HyperlinkType.Url;
                    }
                    else if (_location.StartsWith("mailto:"))
                    {
                        _type = HyperlinkType.Email;
                    }
                    else
                    {
                        _type = HyperlinkType.File;
                    }
                }
            }
        }
开发者ID:mdjasim,项目名称:npoi,代码行数:62,代码来源:XSSFHyperlink.cs

示例9: XWPFHeaderFooter

        public XWPFHeaderFooter(POIXMLDocumentPart parent, PackagePart part, PackageRelationship rel) :
            base(parent, part, rel)
        {
            ;
            this.document = (XWPFDocument)GetParent();

            if (this.document == null)
            {
                throw new NullReferenceException();
            }
        }
开发者ID:JnS-Software-LLC,项目名称:npoi,代码行数:11,代码来源:XWPFHeaderFooter.cs

示例10: ThemesTable

        internal ThemesTable(PackagePart part, PackageRelationship rel)
            : base(part, rel)
        {

            //theme = ThemeDocument.Parse(part.GetInputStream());
            try
            {
                theme = ThemeDocument.Parse(part.GetInputStream());
            }
            catch (XmlException e)
            {
                throw new IOException(e.Message);
            }
        }
开发者ID:WPG,项目名称:npoi,代码行数:14,代码来源:ThemesTable.cs

示例11: ThemesTable

        /**
         * Construct a ThemesTable.
         * @param part A PackagePart.
         * @param rel A PackageRelationship.
         */
        internal ThemesTable(PackagePart part, PackageRelationship rel)
            : base(part, rel)
        {

            XmlDocument xmldoc = ConvertStreamToXml(part.GetInputStream());
                
            try
            {
                theme = ThemeDocument.Parse(xmldoc, NamespaceManager);
            }
            catch (XmlException e)
            {
                throw new IOException(e.Message);
            }
        }
开发者ID:twxstar,项目名称:npoi,代码行数:20,代码来源:ThemesTable.cs

示例12: XSSFHyperlink

        /**
         * Create a XSSFHyperlink amd Initialize it from the supplied CTHyperlink bean and namespace relationship
         *
         * @param ctHyperlink the xml bean Containing xml properties
         * @param hyperlinkRel the relationship in the underlying OPC namespace which stores the actual link's Address
         */
        public XSSFHyperlink(CT_Hyperlink ctHyperlink, PackageRelationship hyperlinkRel)
        {
            _ctHyperlink = ctHyperlink;
            _externalRel = hyperlinkRel;

            // Figure out the Hyperlink type and distination

            // If it has a location, it's internal
            if (ctHyperlink.location != null)
            {
                _type = HyperlinkType.DOCUMENT;
                _location = ctHyperlink.location;
            }
            else
            {
                // Otherwise it's somehow external, check
                //  the relation to see how
                if (_externalRel == null)
                {
                    if (ctHyperlink.id != null)
                    {
                        throw new InvalidOperationException("The hyperlink for cell " + 
                            [email protected] + " references relation " + ctHyperlink.id + ", but that didn't exist!");
                    }
                    throw new InvalidOperationException("A sheet hyperlink must either have a location, or a relationship. Found:\n" + ctHyperlink);
                }

                Uri target = _externalRel.TargetUri;
                _location = target.ToString();

                // Try to figure out the type
                if (_location.StartsWith("http://") || _location.StartsWith("https://")
                        || _location.StartsWith("ftp://"))
                {
                    _type = HyperlinkType.URL;
                }
                else if (_location.StartsWith("mailto:"))
                {
                    _type = HyperlinkType.EMAIL;
                }
                else
                {
                    _type = HyperlinkType.FILE;
                }
            }
        }
开发者ID:hanwangkun,项目名称:npoi,代码行数:52,代码来源:XSSFHyperlink.cs

示例13: SetPictureReference

 /**
  * Link this shape with the picture data
  *
  * @param rel relationship referring the picture data
  */
 internal void SetPictureReference(PackageRelationship rel)
 {
     ctPicture.blipFill.blip.embed = rel.Id;
 }
开发者ID:hanwangkun,项目名称:npoi,代码行数:9,代码来源:XSSFPicture.cs

示例14: IsRelationshipExists

 /**
  * Checks if the specified relationship is part of this package part.
  * 
  * @param rel
  *            The relationship to check.
  * @return <b>true</b> if the specified relationship exists in this part,
  *         else returns <b>false</b>
  * @see org.apache.poi.OpenXml4Net.opc.RelationshipSource#isRelationshipExists(org.apache.poi.OpenXml4Net.opc.PackageRelationship)
  */
 public bool IsRelationshipExists(PackageRelationship rel)
 {
     try
     {
         foreach (PackageRelationship r in this.Relationships)
         {
             if (r == rel)
                 return true;
         }
     }
     catch (InvalidFormatException)
     { 
     
     }
     return false;
 }
开发者ID:ctddjyds,项目名称:npoi,代码行数:25,代码来源:PackagePart.cs

示例15: XWPFPictureData

 /**
  * Construct XWPFPictureData from a package part
  *
  * @param part the package part holding the Drawing data,
  * @param rel  the package relationship holding this Drawing,
  * the relationship type must be http://schemas.Openxmlformats.org/officeDocument/2006/relationships/image
  */
 public XWPFPictureData(PackagePart part, PackageRelationship rel)
     : base(part, rel)
 {
 }
开发者ID:xiepeixing,项目名称:npoi,代码行数:11,代码来源:XWPFPictureData.cs


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