本文整理汇总了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();
}
}
}
示例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();
}
}
示例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[] { }));
}
示例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();
}
}
示例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());
}
示例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);
}