Class AttachedFile

Class AttachedFile

Tên không gian: Aspose.Note Tổng hợp: Aspose.Note.dll (25.4.0)

Nó đại diện cho một tập tin được thêm vào.

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

Inheritance

object Node AttachedFile

Implements

IPageChildNode , IOutlineElementChildNode , ITaggable , INode

Thành viên thừa kế

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

Hiển thị làm thế nào để có được nội dung của một tệp gắn kết.

// 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>

Hiển thị cách thêm tệp vào một tài liệu bằng cách sử dụng filepath.

// 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);

Hiển thị cách thêm một tệp từ một dòng vào một tài liệu.

// 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(String)

Bắt đầu một trường hợp mới của lớp Aspose.Note.AttachedFile.

public AttachedFile(string path)

Parameters

path string

Một dòng chứa con đường đến tệp từ đó để tạo Aspose.Note.AttachedFile.

AttachedFile(String, Stream và ImageFormat)

Bắt đầu một trường hợp mới của lớp Aspose.Note.AttachedFile.

public AttachedFile(string path, Stream icon, ImageFormat iconFormat)

Parameters

path string

Một dòng chứa con đường đến tệp từ đó để tạo Aspose.Note.AttachedFile.

icon Stream

Một biểu tượng cho tệp được thêm vào.

iconFormat ImageFormat

Một định dạng của biểu tượng tệp được gắn.

AttachedFile(Stream , Stream)

Bắt đầu một trường hợp mới của lớp Aspose.Note.AttachedFile.

public AttachedFile(string fileName, Stream attachedFileStream)

Parameters

fileName string

Một tên của tệp được gắn.

attachedFileStream Stream

Một dòng chứa các byte tệp được gắn.

AttachedFile(dòng, Stream, ImageFormat)

Bắt đầu một trường hợp mới của lớp Aspose.Note.AttachedFile.

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

Parameters

fileName string

Một tên của tệp được gắn.

attachedFileStream Stream

Một dòng chứa các byte tệp được gắn.

icon Stream

Một biểu tượng cho tệp được thêm vào.

iconFormat ImageFormat

Một định dạng của biểu tượng tệp được gắn.

AttachedFile()

Bắt đầu một trường hợp mới của lớp Aspose.Note.AttachedFile.

public AttachedFile()

Properties

Alignment

Nhận hoặc đặt sự sắp xếp.

public HorizontalAlignment Alignment { get; set; }

Giá trị bất động sản

HorizontalAlignment

AlternativeTextDescription

Nhận hoặc đặt một văn bản thay thế cho biểu tượng của tệp được gắn.

public string AlternativeTextDescription { get; set; }

Giá trị bất động sản

string

AlternativeTextTitle

Nhận hoặc đặt một tiêu đề văn bản thay thế cho biểu tượng của tệp được gắn.

public string AlternativeTextTitle { get; set; }

Giá trị bất động sản

string

Bytes

Nhận dữ liệu nhị phân cho một tệp tích hợp.

public byte[] Bytes { get; }

Giá trị bất động sản

byte [ ]

Examples

Hiển thị làm thế nào để có được nội dung của một tệp gắn kết.

// 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

Nhận phần mở rộng của một tệp tích hợp.

public string Extension { get; }

Giá trị bất động sản

string

FileName

Nhận tên của tệp được nhúng.

public string FileName { get; }

Giá trị bất động sản

string

FilePath

Có được con đường đến tập tin ban đầu.

public string FilePath { get; }

Giá trị bất động sản

string

Height

Nhận chiều cao ban đầu của biểu tượng tệp nhúng.

public float Height { get; }

Giá trị bất động sản

float

HorizontalOffset

Nhận hoặc đặt offset ngang.

public float HorizontalOffset { get; set; }

Giá trị bất động sản

float

Icon

Nhận dữ liệu nhị phân cho biểu tượng được liên kết với tệp tích hợp.

public byte[] Icon { get; }

Giá trị bất động sản

byte [ ]

IconExtension

Nhận sự mở rộng của biểu tượng.

public string IconExtension { get; }

Giá trị bất động sản

string

IsPrintout

Nhận hoặc đặt một giá trị cho thấy xem tệp là in.

public bool IsPrintout { get; set; }

Giá trị bất động sản

bool

IsSizeSetByUser

Nhận hoặc đặt một giá trị cho thấy liệu giá của kích cỡ của biểu tượng đã được người dùng cập nhật rõ ràng hay không.

public bool IsSizeSetByUser { get; set; }

Giá trị bất động sản

bool

LastModifiedTime

Nhận hoặc đặt thời gian sửa đổi cuối cùng.

public DateTime LastModifiedTime { get; set; }

Giá trị bất động sản

DateTime

MaxHeight

Nhận hoặc đặt chiều cao tối đa để hiển thị biểu tượng tệp tích hợp.

public float MaxHeight { get; set; }

Giá trị bất động sản

float

MaxWidth

Nhận hoặc đặt chiều rộng tối đa để hiển thị biểu tượng tệp tích hợp.

public float MaxWidth { get; set; }

Giá trị bất động sản

float

ParsingErrorInfo

Nhận dữ liệu về lỗi xảy ra trong khi truy cập vào tệp.

public ParsingErrorInfo ParsingErrorInfo { get; }

Giá trị bất động sản

ParsingErrorInfo

Tags

Nhận danh sách tất cả các thẻ của một đoạn.

public List<itag> Tags { get; }

Giá trị bất động sản

List < ITag >

Text

Nhận hoặc đặt biểu tượng văn bản của tệp được nhúng. dòng KHÔNG có chứa bất kỳ ký tự nào của giá trị 10 (một dòng nguồn) hoặc 13 (tái tải).

public string Text { get; set; }

Giá trị bất động sản

string

VerticalOffset

Nhận hoặc đặt bồi thường dọc.

public float VerticalOffset { get; set; }

Giá trị bất động sản

float

Width

Có được chiều rộng ban đầu của biểu tượng tệp nhúng.

public float Width { get; }

Giá trị bất động sản

float

Methods

Accept(DocumentVisitor)

chấp nhận khách truy cập của nút.

public override void Accept(DocumentVisitor visitor)

Parameters

visitor DocumentVisitor

Đối tượng của một lớp được lấy từ Aspose.Note.DocumentVisitor.

 Tiếng Việt