Class AttachedFile
名称: Aspose.Note 集合: Aspose.Note.dll (25.4.0)
代表附加的文件。
public class AttachedFile : Node, IPageChildNode, IOutlineElementChildNode, ITaggable, INode
{
private string _path;
public string Path
{
get { return this._path; }
set { this._path = value; }
}
}
Inheritance
object ← Node ← AttachedFile
Implements
IPageChildNode , IOutlineElementChildNode , ITaggable , INode
继承人
Node.Accept(DocumentVisitor) , Node.Document , Node.IsComposite , Node.NodeType , Node.ParentNode , Node.PreviousSibling , Node.NextSibling , object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()
Examples
显示如何从附件文件中获取内容。
string dataDir = RunExamples.GetDataDir_Attachments();
Document oneFile = new Document(dataDir + "Sample1.one");
IList<attachedfile> nodes = oneFile.GetChildNodes<attachedfile>();
foreach (AttachedFile file in nodes)
{
using (Stream outputStream = new MemoryStream(file.Bytes))
{
using (System.IO.FileStream fileStream = System.IO.File.OpenWrite(String.Format(dataDir + file.FileName)))
{
CopyStream(outputStream, fileStream);
}
}
}
显示如何使用文件路径将文件添加到文档中。
string dataDir = RunExamples.GetDataDir_Attachments();
Document doc = new Document();
Aspose.Note.Page page = new Aspose.Note.Page(doc);
Outline outline = new Outline(doc);
OutlineElement outlineElem = new OutlineElement(doc);
AttachedFile attachedFile = new AttachedFile(doc, dataDir + "attachment.txt");
outlineElem.AppendChildLast(attachedFile);
outline.AppendChildLast(outlineElem);
page.AppendChildLast(outline);
doc.AppendChildLast(page);
dataDir += "AttachFileByPath_out.one";
doc.Save(dataDir);
显示如何从流中添加文件到文档。
string dataDir = RunExamples.GetDataDir_Attachments();
Document doc = new Document();
Aspose.Note.Page page = new Aspose.Note.Page(doc);
Outline outline = new Outline(doc);
OutlineElement outlineElem = new OutlineElement(doc);
using (var stream = File.OpenRead(dataDir + "icon.jpg"))
{
AttachedFile attachedFile = new AttachedFile(doc, dataDir + "attachment.txt", stream, ImageFormat.Jpeg);
outlineElem.AppendChildLast(attachedFile);
}
outline.AppendChildLast(outlineElem);
page.AppendChildLast(outline);
doc.AppendChildLast(page);
dataDir += "AttachFileAndSetIcon_out.one";
doc.Save(dataDir);
Constructors
附加文件(string)
启动 Aspose.Note.AttachedFile 类的新例子。
public AttachedFile(string path)
{
}
Parameters
path
string
包含路径到文件,从该文件创建 Aspose.Note.AttachedFile。
AttachedFile(string、Stream、ImageFormat)
启动 Aspose.Note.AttachedFile 类的新例子。
public AttachedFile(string path, Stream icon, ImageFormat iconFormat)
{
}
Parameters
path
string
包含路径到文件,从该文件创建 Aspose.Note.AttachedFile。
icon
Stream
附加文件的图标。
iconFormat
ImageFormat
附件文件图标的格式。
AttachedFile(流,流)
启动 Aspose.Note.AttachedFile 类的新例子。
public AttachedFile(string fileName, Stream attachedFileStream)
{
}
Parameters
fileName
string
附件文件的名称。
attachedFileStream
Stream
一个流,包含附件的文件比特。
AttachedFile(string、Stream、Straam 和 ImageFormat)
启动 Aspose.Note.AttachedFile 类的新例子。
public AttachedFile(
string fileName,
Stream attachedFileStream,
Stream icon,
ImageFormat iconFormat)
{
}
Parameters
fileName
string
附件文件的名称。
attachedFileStream
Stream
一个流,包含附件的文件比特。
icon
Stream
附加文件的图标。
iconFormat
ImageFormat
附件文件图标的格式。
附加文件( )
启动 Aspose.Note.AttachedFile 类的新例子。
public AttachedFile()
{
}
Properties
Alignment
接收或设置调整。
public HorizontalAlignment Alignment
{
get;
set;
}
财产价值
AlternativeTextDescription
收到或设置一个身体的附件文件的图标的替代文本。
public string AlternativeTextDescription
{
get;
set;
}
财产价值
AlternativeTextTitle
收到或设置替代文本标题为附件文件的图标。
public string AlternativeTextTitle
{
get;
set;
}
财产价值
Bytes
获取内置文件的二进制数据。
public byte[] Bytes
{
get;
}
财产价值
byte ( )
Examples
显示如何从附件文件中获取内容。
string dataDir = RunExamples.GetDataDir_Attachments();
Document oneFile = new Document(dataDir + "Sample1.one");
IList<attachedfile> nodes = oneFile.GetChildNodes<attachedfile>();
foreach (AttachedFile file in nodes)
{
using (Stream outputStream = new MemoryStream(file.Bytes))
{
using (System.IO.FileStream fileStream = System.IO.File.OpenWrite(String.Format(dataDir + file.FileName)))
{
CopyStream(outputStream, fileStream);
}
}
}
Extension
收到嵌入式文件的扩展。
public string Extension
{
get;
}
财产价值
FileName
获取嵌入文件的名称。
public string FileName
{
get;
}
财产价值
FilePath
接到原始文件的路径。
public string FilePath
{
get;
}
财产价值
Height
获得内置文件图标的原始高度。
public float Height
{
get;
}
财产价值
HorizontalOffset
接收或设置水平折扣。
public float HorizontalOffset
{
get;
set;
}
财产价值
Icon
获取与内置文件相关的图标的二进制数据。
public byte[] Icon
{
get;
}
财产价值
byte ( )
IconExtension
接收图标的扩展。
public string IconExtension
{
get;
}
财产价值
IsPrintout
收到或设置一个值,表明文件的视图是否打印。
public bool IsPrintout
{
get;
set;
}
财产价值
IsSizeSetByUser
收到或设置值,表明图标尺寸的值是否被用户明确更新。
public bool IsSizeSetByUser
{
get;
set;
}
财产价值
LastModifiedTime
接收或设置最后修改时间。
public DateTime LastModifiedTime
{
get;
set;
}
财产价值
MaxHeight
获取或设置最大高度显示内置文件图标。
public float MaxHeight
{
get;
set;
}
财产价值
MaxWidth
获取或设置最大宽度以显示内置文件图标。
public float MaxWidth
{
get;
set;
}
财产价值
ParsingErrorInfo
获取有关访问文件时发生的错误的数据。
public ParsingErrorInfo ParsingErrorInfo
{
get;
}
财产价值
Tags
收到一个段落的所有标签列表。
public List<ITag> Tags { get; }
财产价值
Text
接收或设置嵌入式文件的文本代表性. 字符串不应包含值 10 (线源) 或 13 (货运回报) 的任何符号。
public string Text
{
get { return this._text; }
set { this._text = value; }
}
private string _text;
财产价值
VerticalOffset
接收或设置垂直折扣。
public float VerticalOffset
{
get;
set;
}
财产价值
Width
获取嵌入文件图标的原始宽度。
public float Width
{
get;
}
财产价值
Methods
接收文件(DocumentVisitor)
接待节点的参观者。
public override void Accept(DocumentVisitor visitor)
{
}
Parameters
visitor
DocumentVisitor
一个类的对象源于 Aspose.Note.DocumentVisitor。