Exemple #1
0
 /// <summary>
 /// Removes the relation from the internal table.
 /// Following readings of files will ignoring the removed relation.
 /// </summary>
 /// <param name="relation">Relation to remove</param>
 public static void RemoveRelation(XSSFRelation relation)
 {
     if (_table.ContainsKey(relation._relation))
     {
         _table.Remove(relation._relation);
     }
 }
Exemple #2
0
 /// <summary>
 /// Adds the relation to the internal table.
 /// Following readings of files will process the given relation.
 /// </summary>
 /// <param name="relation">Relation to add</param>
 internal static void AddRelation(XSSFRelation relation)
 {
     if ((null != relation._type) && !_table.ContainsKey(relation._relation))
     {
         _table.Add(relation._relation, relation);
     }
 }
Exemple #3
0
        public override POIXMLDocumentPart CreateDocumentPart(POIXMLDocumentPart parent, PackageRelationship rel, PackagePart part)
        {
            POIXMLRelation instance = (POIXMLRelation)XSSFRelation.GetInstance(rel.RelationshipType);

            if (instance != null)
            {
                if (instance.RelationClass != null)
                {
                    try
                    {
                        return((POIXMLDocumentPart)instance.RelationClass.GetConstructor(BindingFlags.Instance | BindingFlags.NonPublic, (Binder)null, new Type[2] {
                            typeof(PackagePart), typeof(PackageRelationship)
                        }, (ParameterModifier[])null).Invoke(new object[2] {
                            (object)part, (object)rel
                        }));
                    }
                    catch (Exception ex)
                    {
                        throw new POIXMLException(ex);
                    }
                }
            }
            XSSFFactory.logger.Log(1, (object)("using default POIXMLDocumentPart for " + rel.RelationshipType));
            return(new POIXMLDocumentPart(part, rel));
        }
Exemple #4
0
 internal static void AddRelation(XSSFRelation relation)
 {
     if (relation._type == null || XSSFRelation._table.ContainsKey(relation._relation))
     {
         return;
     }
     XSSFRelation._table.Add(relation._relation, relation);
 }
Exemple #5
0
 public static void RemoveRelation(XSSFRelation relation)
 {
     if (!XSSFRelation._table.ContainsKey(relation._relation))
     {
         return;
     }
     XSSFRelation._table.Remove(relation._relation);
 }
Exemple #6
0
        public override POIXMLDocumentPart CreateDocumentPart(POIXMLDocumentPart parent, PackageRelationship rel, PackagePart part)
        {
            POIXMLRelation descriptor = XSSFRelation.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;
                ConstructorInfo constructor = cls.GetConstructor(BindingFlags.NonPublic | BindingFlags.Instance, null, new Type[] { typeof(PackagePart), typeof(PackageRelationship) }, null);
                return((POIXMLDocumentPart)constructor.Invoke(new object[] { part, rel }));
            }
            catch (Exception e)
            {
                throw new POIXMLException(e);
            }
        }
Exemple #7
0
 /// <summary>
 /// Adds the relation to the internal table.
 /// Following readings of files will process the given relation.
 /// </summary>
 /// <param name="relation">Relation to add</param>
 internal static void AddRelation(XSSFRelation relation)
 {
     if ((null != relation._type) && !_table.ContainsKey(relation._relation))
     {
         _table.Add(relation._relation, relation);
     }
 }
Exemple #8
0
 /// <summary>
 /// Removes the relation from the internal table.
 /// Following readings of files will ignoring the removed relation.
 /// </summary>
 /// <param name="relation">Relation to remove</param>
 public static void RemoveRelation(XSSFRelation relation)
 {
     if (_table.ContainsKey(relation._relation))
     {
         _table.Remove(relation._relation);
     }
 }
Exemple #9
0
 /**
  * @since POI 3.14-Beta1
  */
 protected override POIXMLRelation GetDescriptor(String relationshipType)
 {
     return(XSSFRelation.GetInstance(relationshipType));
 }