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


C# DirectoryEntry.CreateDocument方法代码示例

本文整理汇总了C#中DirectoryEntry.CreateDocument方法的典型用法代码示例。如果您正苦于以下问题:C# DirectoryEntry.CreateDocument方法的具体用法?C# DirectoryEntry.CreateDocument怎么用?C# DirectoryEntry.CreateDocument使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DirectoryEntry的用法示例。


在下文中一共展示了DirectoryEntry.CreateDocument方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CopyNodeRecursively

        /**
         * Copies an Entry into a target POIFS directory, recursively
         */

        public static void CopyNodeRecursively(Entry entry, DirectoryEntry target)
        {
            // System.err.println("copyNodeRecursively called with "+entry.GetName()+
            // ","+tarGet.getName());
            DirectoryEntry newTarget = null;
            if (entry.IsDirectoryEntry)
            {
                newTarget = target.CreateDirectory(entry.Name);
                IEnumerator entries = ((DirectoryEntry)entry).Entries;

                while (entries.MoveNext())
                {
                    CopyNodeRecursively((Entry)entries.Current, newTarget);
                }
            }
            else
            {
                DocumentEntry dentry = (DocumentEntry)entry;
                using (DocumentInputStream dstream = new DocumentInputStream(dentry))
                {
                    target.CreateDocument(dentry.Name, dstream);
                    //now part of usings call to Dispose: dstream.Close();
                }
            }
        }
开发者ID:Johnnyfly,项目名称:source20131023,代码行数:29,代码来源:POIUtils.cs

示例2: CopyNodeRecursively

        /**
     * Copies an Entry into a target POIFS directory, recursively
     */
        public static void CopyNodeRecursively(Entry entry, DirectoryEntry target)
        {
            // System.err.println("copyNodeRecursively called with "+entry.getName()+
            // ","+target.getName());
            DirectoryEntry newTarget = null;
            if (entry.IsDirectoryEntry)
            {
                DirectoryEntry dirEntry = (DirectoryEntry)entry;
                newTarget = target.CreateDirectory(entry.Name);
                newTarget.StorageClsid=(dirEntry.StorageClsid);
                IEnumerator<Entry> entries = dirEntry.Entries;

                while (entries.MoveNext())
                {
                    CopyNodeRecursively((Entry)entries.Current, newTarget);
                }
            }
            else
            {
                DocumentEntry dentry = (DocumentEntry)entry;
                DocumentInputStream dstream = new DocumentInputStream(dentry);
                target.CreateDocument(dentry.Name, dstream);
                dstream.Close();
            }
        }
开发者ID:Reinakumiko,项目名称:npoi,代码行数:28,代码来源:EntryUtils.cs

示例3: setUp

 protected void setUp()
 {
     fs = new POIFSFileSystem();
     dirA = fs.CreateDirectory("DirA");
     dirB = fs.CreateDirectory("DirB");
     dirAA = dirA.CreateDirectory("DirAA");
     eRoot = fs.Root.CreateDocument("Root", new ByteArrayInputStream(new byte[] { }));
     eA = dirA.CreateDocument("NA", new ByteArrayInputStream(new byte[] { }));
     eAA = dirAA.CreateDocument("NAA", new ByteArrayInputStream(new byte[] { }));
 }
开发者ID:hanwangkun,项目名称:npoi,代码行数:10,代码来源:TestFilteringDirectoryNode.cs

示例4: CopyNodeRecursively

        /// <summary>
        /// Copies an Entry into a target POIFS directory, recursively
        /// </summary>
        /// <param name="entry">The entry.</param>
        /// <param name="target">The target.</param>
        private void CopyNodeRecursively(Entry entry, DirectoryEntry target)
        {
            //System.err.println("copyNodeRecursively called with "+entry.Name+
            //                   ","+target.Name);
            DirectoryEntry newtarget = null;
            if (entry.IsDirectoryEntry)
            {
                newtarget = target.CreateDirectory(entry.Name);
                IEnumerator entries = ((DirectoryEntry)entry).Entries;

                while (entries.MoveNext())
                {
                    CopyNodeRecursively((Entry)entries.Current, newtarget);
                }
            }
            else
            {
                DocumentEntry dentry = (DocumentEntry)entry;
                POIFSDocumentReader dstream = new POIFSDocumentReader(dentry);
                target.CreateDocument(dentry.Name, dstream);
                dstream.Close();
            }
        }
开发者ID:ChiangHanLung,项目名称:PIC_VDS,代码行数:28,代码来源:POIDocument.cs

示例5: Write

 /// <summary>
 /// Writes a property Set To a document in a POI filesystem directory
 /// </summary>
 /// <param name="dir">The directory in the POI filesystem To Write the document To.</param>
 /// <param name="name">The document's name. If there is alReady a document with the
 /// same name in the directory the latter will be overwritten.</param>
 public virtual void Write(DirectoryEntry dir, String name)
 {
     /* If there is alReady an entry with the same name, Remove it. */
     try
     {
         Entry e = dir.GetEntry(name);
         e.Delete();
     }
     catch (FileNotFoundException)
     {
         /* Entry not found, no need To Remove it. */
     }
     /* Create the new entry. */
     dir.CreateDocument(name, GetStream());
 }
开发者ID:xiepeixing,项目名称:npoi,代码行数:21,代码来源:MutablePropertySet.cs

示例6: NDocumentOutputStream

        /**
         * Create an OutputStream to create the specified new Entry
         * 
         * @param parent Where to create the Entry
         * @param name Name of the new entry
         */
        public NDocumentOutputStream(DirectoryEntry parent, String name)
        {
            if (!(parent is DirectoryNode))
            {
                throw new IOException("Cannot open internal directory storage, " + parent + " not a Directory Node");
            }
            _document_size = 0;
            _closed = false;

            // Have an empty one Created for now
            DocumentEntry doc = parent.CreateDocument(name, new MemoryStream(new byte[0]));
            _property = (DocumentProperty)((DocumentNode)doc).Property;
            _document = new NPOIFSDocument((DocumentNode)doc);
        }
开发者ID:newlysoft,项目名称:NStorage,代码行数:20,代码来源:NDocumentOutputStream.cs


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