Class AttachedFile

Class AttachedFile

名称: Aspose.Note 集合: Aspose.Note.dll (25.4.0)

代表附加的文件。

public class AttachedFile : Node, IPageChildNode, IOutlineElementChildNode, ITaggable, INode

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

显示如何从附件文件中获取内容。

// The path to the documents directory.
                                                        string dataDir = RunExamples.GetDataDir_Attachments();

                                                        // Load the document into Aspose.Note.
                                                        Document oneFile = new Document(dataDir + "Sample1.one");

                                                        // Get a list of attached file nodes
                                                        IList<attachedfile> nodes = oneFile.GetChildNodes<attachedfile>();

                                                        // Iterate through all nodes
                                                        foreach (AttachedFile file in nodes)
                                                        {
                                                            // Load attached file to a stream object
                                                            using (Stream outputStream = new MemoryStream(file.Bytes))
                                                            {
                                                                // Create a local file
                                                                using (Stream fileStream = System.IO.File.OpenWrite(String.Format(dataDir + file.FileName)))
                                                                {
                                                                    // Copy file stream
                                                                    CopyStream(outputStream, fileStream);
                                                                }
                                                            }
                                                        }</attachedfile></attachedfile>

显示如何使用文件路径将文件添加到文档中。

// The path to the documents directory.
                                                                   string dataDir = RunExamples.GetDataDir_Attachments();

                                                                   // Create an object of the Document class
                                                                   Document doc = new Document();

                                                                   // Initialize Page class object
                                                                   Aspose.Note.Page page = new Aspose.Note.Page(doc);

                                                                   // Initialize Outline class object
                                                                   Outline outline = new Outline(doc);

                                                                   // Initialize OutlineElement class object
                                                                   OutlineElement outlineElem = new OutlineElement(doc);

                                                                   // Initialize AttachedFile class object
                                                                   AttachedFile attachedFile = new AttachedFile(doc,  dataDir + "attachment.txt");

                                                                   // Add attached file
                                                                   outlineElem.AppendChildLast(attachedFile);

                                                                   // Add outline element node
                                                                   outline.AppendChildLast(outlineElem);

                                                                   // Add outline node
                                                                   page.AppendChildLast(outline);

                                                                   // Add page node
                                                                   doc.AppendChildLast(page);

                                                                   dataDir = dataDir + "AttachFileByPath_out.one";
                                                                   doc.Save(dataDir);

显示如何从流中添加文件到文档。

// The path to the documents directory.
                                                               string dataDir = RunExamples.GetDataDir_Attachments();

                                                               // Create an object of the Document class
                                                               Document doc = new Document();

                                                               // Initialize Page class object
                                                               Aspose.Note.Page page = new Aspose.Note.Page(doc);

                                                               // Initialize Outline class object
                                                               Outline outline = new Outline(doc);

                                                               // Initialize OutlineElement class object
                                                               OutlineElement outlineElem = new OutlineElement(doc);

                                                               using (var stream = File.OpenRead(dataDir + "icon.jpg"))
                                                               {
                                                                   // Initialize AttachedFile class object and also pass its icon path
                                                                   AttachedFile attachedFile = new AttachedFile(doc, dataDir + "attachment.txt", stream, ImageFormat.Jpeg);

                                                                   // Add attached file
                                                                   outlineElem.AppendChildLast(attachedFile);
                                                               }

                                                               // Add outline element node
                                                               outline.AppendChildLast(outlineElem);

                                                               // Add outline node
                                                               page.AppendChildLast(outline);

                                                               // Add page node
                                                               doc.AppendChildLast(page);

                                                               dataDir = dataDir + "AttachFileAndSetIcon_out.one";
                                                               doc.Save(dataDir);

Constructors

AttachedFile(线条)

启动 Aspose.Note.AttachedFile 类的新例子。

public AttachedFile(string path)

Parameters

path string

包含路径到文件,从该文件创建 Aspose.Note.AttachedFile。

AttachedFile(字符串, 流, 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(字符串, 流, Stream, ImageFormat)

启动 Aspose.Note.AttachedFile 类的新例子。

public AttachedFile(string fileName, Stream attachedFileStream, Stream icon, ImageFormat iconFormat)

Parameters

fileName string

附件文件的名称。

attachedFileStream Stream

一个流,包含附件的文件比特。

icon Stream

附加文件的图标。

iconFormat ImageFormat

附件文件图标的格式。

AttachedFile()

启动 Aspose.Note.AttachedFile 类的新例子。

public AttachedFile()

Properties

Alignment

接收或设置调整。

public HorizontalAlignment Alignment { get; set; }

财产价值

HorizontalAlignment

AlternativeTextDescription

收到或设置一个身体的附件文件的图标的替代文本。

public string AlternativeTextDescription { get; set; }

财产价值

string

AlternativeTextTitle

收到或设置替代文本标题为附件文件的图标。

public string AlternativeTextTitle { get; set; }

财产价值

string

Bytes

获取内置文件的二进制数据。

public byte[] Bytes { get; }

财产价值

byte ( )

Examples

显示如何从附件文件中获取内容。

// The path to the documents directory.
                                                        string dataDir = RunExamples.GetDataDir_Attachments();

                                                        // Load the document into Aspose.Note.
                                                        Document oneFile = new Document(dataDir + "Sample1.one");

                                                        // Get a list of attached file nodes
                                                        IList<attachedfile> nodes = oneFile.GetChildNodes<attachedfile>();

                                                        // Iterate through all nodes
                                                        foreach (AttachedFile file in nodes)
                                                        {
                                                            // Load attached file to a stream object
                                                            using (Stream outputStream = new MemoryStream(file.Bytes))
                                                            {
                                                                // Create a local file
                                                                using (Stream fileStream = System.IO.File.OpenWrite(String.Format(dataDir + file.FileName)))
                                                                {
                                                                    // Copy file stream
                                                                    CopyStream(outputStream, fileStream);
                                                                }
                                                            }
                                                        }</attachedfile></attachedfile>

Extension

收到嵌入式文件的扩展。

public string Extension { get; }

财产价值

string

FileName

获取嵌入文件的名称。

public string FileName { get; }

财产价值

string

FilePath

接到原始文件的路径。

public string FilePath { get; }

财产价值

string

Height

获得内置文件图标的原始高度。

public float Height { get; }

财产价值

float

HorizontalOffset

接收或设置水平折扣。

public float HorizontalOffset { get; set; }

财产价值

float

Icon

获取与内置文件相关的图标的二进制数据。

public byte[] Icon { get; }

财产价值

byte ( )

IconExtension

接收图标的扩展。

public string IconExtension { get; }

财产价值

string

IsPrintout

收到或设置一个值,表明文件的视图是否打印。

public bool IsPrintout { get; set; }

财产价值

bool

IsSizeSetByUser

收到或设置值,表明图标尺寸的值是否被用户明确更新。

public bool IsSizeSetByUser { get; set; }

财产价值

bool

LastModifiedTime

接收或设置最后修改时间。

public DateTime LastModifiedTime { get; set; }

财产价值

DateTime

MaxHeight

获取或设置最大高度显示内置文件图标。

public float MaxHeight { get; set; }

财产价值

float

MaxWidth

获取或设置最大宽度以显示内置文件图标。

public float MaxWidth { get; set; }

财产价值

float

ParsingErrorInfo

获取有关访问文件时发生的错误的数据。

public ParsingErrorInfo ParsingErrorInfo { get; }

财产价值

ParsingErrorInfo

Tags

收到一个段落的所有标签列表。

public List<itag> Tags { get; }

财产价值

List < ITag >

Text

接收或设置嵌入式文件的文本代表性. 字符串不应包含值 10 (线源) 或 13 (货运回报) 的任何符号。

public string Text { get; set; }

财产价值

string

VerticalOffset

接收或设置垂直折扣。

public float VerticalOffset { get; set; }

财产价值

float

Width

获取嵌入文件图标的原始宽度。

public float Width { get; }

财产价值

float

Methods

Accept(DocumentVisitor)

接待节点的参观者。

public override void Accept(DocumentVisitor visitor)

Parameters

visitor DocumentVisitor

一个类的对象源于 Aspose.Note.DocumentVisitor。

 中文