Class AttachedFile

Class AttachedFile

Il nome: Aspose.Note Assemblea: Aspose.Note.dll (25.4.0)

Si tratta di un file allegato.

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

Inheritance

object Node AttachedFile

Implements

IPageChildNode , IOutlineElementChildNode , ITaggable , INode

I membri ereditari

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 come ottenere il contenuto di un file allegato.

// 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 come aggiungere un file a un documento utilizzando il 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 come aggiungere un file da un flusso a un 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(String)

Inizia una nuova instanza della classe Aspose.Note.AttachedFile.

public AttachedFile(string path)

Parameters

path string

Una riga che contiene il percorso per il file da cui creare il Aspose.Note.AttachedFile.

AttachedFile(String, Stream e Immagini)

Inizia una nuova instanza della classe Aspose.Note.AttachedFile.

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

Parameters

path string

Una riga che contiene il percorso per il file da cui creare il Aspose.Note.AttachedFile.

icon Stream

Un’icona per il file allegato.

iconFormat ImageFormat

Un formato dell’icona del file allegato.

AttachedFile(Strumento, Stream)

Inizia una nuova instanza della classe Aspose.Note.AttachedFile.

public AttachedFile(string fileName, Stream attachedFileStream)

Parameters

fileName string

Il nome del file allegato.

attachedFileStream Stream

Un flusso che contiene i byti di file allegati.

AttachedFile(String, Stream, Immagini di streaming)

Inizia una nuova instanza della classe Aspose.Note.AttachedFile.

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

Parameters

fileName string

Il nome del file allegato.

attachedFileStream Stream

Un flusso che contiene i byti di file allegati.

icon Stream

Un’icona per il file allegato.

iconFormat ImageFormat

Un formato dell’icona del file allegato.

AttachedFile()

Inizia una nuova instanza della classe Aspose.Note.AttachedFile.

public AttachedFile()

Properties

Alignment

Riceve o mette l’alignamento.

public HorizontalAlignment Alignment { get; set; }

Valore di proprietà

HorizontalAlignment

AlternativeTextDescription

Riceve o impone un corpo un testo alternativo per l’icona del file allegato.

public string AlternativeTextDescription { get; set; }

Valore di proprietà

string

AlternativeTextTitle

Riceve o impone un titolo di testo alternativo per l’icona del file allegato.

public string AlternativeTextTitle { get; set; }

Valore di proprietà

string

Bytes

Riceve i dati binari per un file incorporato.

public byte[] Bytes { get; }

Valore di proprietà

byte [ ]

Examples

Mostra come ottenere il contenuto di un file allegato.

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

Riceve l’estensione di un file incorporato.

public string Extension { get; }

Valore di proprietà

string

FileName

Riceve il nome del file incorporato.

public string FileName { get; }

Valore di proprietà

string

FilePath

Prendi il percorso verso il file originale.

public string FilePath { get; }

Valore di proprietà

string

Height

Riceve l’altezza originale dell’icona del file incorporato.

public float Height { get; }

Valore di proprietà

float

HorizontalOffset

Riceve o mette l’offerta orizzontale.

public float HorizontalOffset { get; set; }

Valore di proprietà

float

Icon

Riceve i dati binari per l’icona che è associato al file incorporato.

public byte[] Icon { get; }

Valore di proprietà

byte [ ]

IconExtension

Riceve l’estensione dell’icona.

public string IconExtension { get; }

Valore di proprietà

string

IsPrintout

Riceve o impone un valore che indica se la visualizzazione del file è stampata.

public bool IsPrintout { get; set; }

Valore di proprietà

bool

IsSizeSetByUser

Riceve o impone un valore che indica se il valore della dimensione dell’icona è stato esplicitamente aggiornato dall’utente.

public bool IsSizeSetByUser { get; set; }

Valore di proprietà

bool

LastModifiedTime

Riceve o impone l’ultimo tempo modificato.

public DateTime LastModifiedTime { get; set; }

Valore di proprietà

DateTime

MaxHeight

Riceve o impone la altezza massima per visualizzare l’icona del file incorporato.

public float MaxHeight { get; set; }

Valore di proprietà

float

MaxWidth

Riceve o impone la larghezza massima per visualizzare l’icona del file incorporato.

public float MaxWidth { get; set; }

Valore di proprietà

float

ParsingErrorInfo

Riceve i dati sull’errore che si è verificato durante l’accesso al file.

public ParsingErrorInfo ParsingErrorInfo { get; }

Valore di proprietà

ParsingErrorInfo

Tags

Riceve la lista di tutte le etichette di un paragrafo.

public List<itag> Tags { get; }

Valore di proprietà

List di < ITag >

Text

Riceve o impone la rappresentazione del testo del file incorporato. La riga NON deve contenere alcun carattere del valore 10 (fido di linea) o 13 (ritorno di carico).

public string Text { get; set; }

Valore di proprietà

string

VerticalOffset

Riceve o mette il rimborso verticale.

public float VerticalOffset { get; set; }

Valore di proprietà

float

Width

Riceve la larghezza originale dell’icona del file incorporato.

public float Width { get; }

Valore di proprietà

float

Methods

Accept(DocumentVisitor)

Accetta il visitatore del nodo.

public override void Accept(DocumentVisitor visitor)

Parameters

visitor DocumentVisitor

L’oggetto di una classe derivato dal Aspose.Note.DocumentVisitor.

 Italiano