コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SummaryInformation"/> class.
        /// </summary>
        /// <param name="ps">A property Set which should be Created from a summary
        /// information stream.</param>
        public SummaryInformation(PropertySet ps): base(ps)
        {

            if (!IsSummaryInformation)
                throw new UnexpectedPropertySetTypeException("Not a "
                        + GetType().Name);
        }
コード例 #2
0
 /// <summary>
 /// Creates the most specific {@link PropertySet} from an {@link
 /// InputStream}. This is preferrably a {@link
 /// DocumentSummaryInformation} or a {@link SummaryInformation}. If
 /// the specified {@link InputStream} does not contain a property
 /// Set stream, an exception is thrown and the {@link InputStream}
 /// is repositioned at its beginning.
 /// </summary>
 /// <param name="stream">Contains the property set stream's data.</param>
 /// <returns>The Created {@link PropertySet}.</returns>
 public static PropertySet Create(Stream stream)
 {
     PropertySet ps = new PropertySet(stream);
     try
     {
         if (ps.IsSummaryInformation)
             return new SummaryInformation(ps);
         else if (ps.IsDocumentSummaryInformation)
             return new DocumentSummaryInformation(ps);
         else
             return ps;
     }
     catch (UnexpectedPropertySetTypeException)
     {
         /* This exception will never be throws because we alReady checked
          * explicitly for this case above. */
         throw;
     }
 }
コード例 #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SpecialPropertySet"/> class.
 /// </summary>
 /// <param name="ps">The property Set To be encapsulated by the <c>SpecialPropertySet</c></param>
 public SpecialPropertySet(PropertySet ps)
 {
     delegate1 = new MutablePropertySet(ps);
 }
コード例 #4
0
 /// <summary>
 /// Writes out a given ProperySet
 /// </summary>
 /// <param name="name">the (POIFS Level) name of the property to Write.</param>
 /// <param name="Set">the PropertySet to Write out.</param>
 /// <param name="outFS">the POIFSFileSystem to Write the property into.</param>
 protected void WritePropertySet(String name, PropertySet Set, POIFSFileSystem outFS)
 {
     try
     {
         MutablePropertySet mSet = new MutablePropertySet(Set);
         using (MemoryStream bOut = new MemoryStream())
         {
             mSet.Write(bOut);
             byte[] data = bOut.ToArray();
             using (MemoryStream bIn = new MemoryStream(data))
             {
                 outFS.CreateDocument(bIn, name);
             }
             //logger.Log(POILogger.INFO, "Wrote property Set " + name + " of size " + data.Length);
         }
     }
     catch (WritingNotSupportedException)
     {
         Console.Error.WriteLine("Couldn't Write property Set with name " + name + " as not supported by HPSF yet");
     }
 }