Class AttachedFile

Class AttachedFile

Nome do espaço: Aspose.Note Assembleia: Aspose.Note.dll (25.4.0)

Representa um arquivo anexado.

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

Inheritance

object Node AttachedFile

Implements

IPageChildNode , IOutlineElementChildNode , ITaggable , INode

Membros herdados

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

Mostra como obter o conteúdo de um arquivo anexado.

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

Mostra como adicionar um arquivo a um documento usando o 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);

Mostra como adicionar um arquivo de um fluxo a um documento.

// 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(Redação)

Inicia uma nova instância da classe Aspose.Note.AttachedFile.

public AttachedFile(string path)

Parameters

path string

Uma linha que contém o caminho para o arquivo a partir do qual para criar o Aspose.Note.AttachedFile.

AttachedFile(Título: Stream, ImageFormat)

Inicia uma nova instância da classe Aspose.Note.AttachedFile.

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

Parameters

path string

Uma linha que contém o caminho para o arquivo a partir do qual para criar o Aspose.Note.AttachedFile.

icon Stream

Um ícone para o arquivo anexado.

iconFormat ImageFormat

Um formato do ícone de arquivo anexado.

AttachedFile(Remoção, Stream)

Inicia uma nova instância da classe Aspose.Note.AttachedFile.

public AttachedFile(string fileName, Stream attachedFileStream)

Parameters

fileName string

Um nome do arquivo anexado.

attachedFileStream Stream

Uma corrente que contém os bytes de arquivo anexados.

AttachedFile(Título: Stream, Strom, ImageFormat)

Inicia uma nova instância da classe Aspose.Note.AttachedFile.

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

Parameters

fileName string

Um nome do arquivo anexado.

attachedFileStream Stream

Uma corrente que contém os bytes de arquivo anexados.

icon Stream

Um ícone para o arquivo anexado.

iconFormat ImageFormat

Um formato do ícone de arquivo anexado.

AttachedFile()

Inicia uma nova instância da classe Aspose.Note.AttachedFile.

public AttachedFile()

Properties

Alignment

Obtenha ou coloca o alinhamento.

public HorizontalAlignment Alignment { get; set; }

Valor da propriedade

HorizontalAlignment

AlternativeTextDescription

Recebe ou coloca um corpo um texto alternativo para o ícone do arquivo anexado.

public string AlternativeTextDescription { get; set; }

Valor da propriedade

string

AlternativeTextTitle

Recebe ou coloca um título de texto alternativo para o ícone do arquivo anexado.

public string AlternativeTextTitle { get; set; }

Valor da propriedade

string

Bytes

Obter os dados binários para um arquivo incorporado.

public byte[] Bytes { get; }

Valor da propriedade

byte [ ]

Examples

Mostra como obter o conteúdo de um arquivo anexado.

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

Recebe a extensão de um arquivo incorporado.

public string Extension { get; }

Valor da propriedade

string

FileName

Recebe o nome do arquivo incorporado.

public string FileName { get; }

Valor da propriedade

string

FilePath

Faça o caminho para o arquivo original.

public string FilePath { get; }

Valor da propriedade

string

Height

Obtenha a altura original do ícone de arquivo incorporado.

public float Height { get; }

Valor da propriedade

float

HorizontalOffset

Obtenha ou coloca o offset horizontal.

public float HorizontalOffset { get; set; }

Valor da propriedade

float

Icon

Recebe os dados binários para o ícone que está associado ao arquivo incorporado.

public byte[] Icon { get; }

Valor da propriedade

byte [ ]

IconExtension

Obter a extensão do ícone.

public string IconExtension { get; }

Valor da propriedade

string

IsPrintout

Recebe ou coloca um valor indicando se a visão do arquivo é impressa.

public bool IsPrintout { get; set; }

Valor da propriedade

bool

IsSizeSetByUser

Recebe ou coloca um valor indicando se o valor do tamanho do ícone foi explicitamente atualizado pelo usuário.

public bool IsSizeSetByUser { get; set; }

Valor da propriedade

bool

LastModifiedTime

Obter ou definir o último tempo modificado.

public DateTime LastModifiedTime { get; set; }

Valor da propriedade

DateTime

MaxHeight

Obter ou definir a altura máxima para exibir o ícone de arquivo incorporado.

public float MaxHeight { get; set; }

Valor da propriedade

float

MaxWidth

Obter ou definir a largura máxima para exibir o ícone de arquivo incorporado.

public float MaxWidth { get; set; }

Valor da propriedade

float

ParsingErrorInfo

Recebe os dados sobre o erro que ocorreu ao acessar o arquivo.

public ParsingErrorInfo ParsingErrorInfo { get; }

Valor da propriedade

ParsingErrorInfo

Tags

Obter a lista de todas as tags de um parágrafo.

public List<itag> Tags { get; }

Valor da propriedade

List e o PT; ITag >

Text

Recebe ou coloca a representação de texto do arquivo incorporado. A faixa NÃO deve conter quaisquer caracteres do valor 10 (feito de linha) ou 13 (regresso de carga).

public string Text { get; set; }

Valor da propriedade

string

VerticalOffset

Recebe ou coloca a despensa vertical.

public float VerticalOffset { get; set; }

Valor da propriedade

float

Width

Obtenha a largura original do ícone de arquivo incorporado.

public float Width { get; }

Valor da propriedade

float

Methods

Accept(DocumentVisitor)

Acolhe o visitante do nodo.

public override void Accept(DocumentVisitor visitor)

Parameters

visitor DocumentVisitor

O objeto de uma classe derivado do Aspose.Note.DocumentVisitor.

 Português