Class AttachedFile
Nom dels espais: Aspose.Note Assemblea: Aspose.Note.dll (25.4.0)
Representa un fitxer afegit.
public class AttachedFile : Node, IPageChildNode, IOutlineElementChildNode, ITaggable, INode
Inheritance
object ← Node ← AttachedFile
Implements
IPageChildNode , IOutlineElementChildNode , ITaggable , INode
Membres heretats
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 com obtenir el contingut d’un fitxer afegit.
// 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 com afegir un fitxer a un document utilitzant la ruta de fitxers.
// 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 com afegir un fitxer d’un flux a un document.
// 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(Tàrrega)
Inicialitza una nova instància de la classe Aspose.Note.AttachedFile.
public AttachedFile(string path)
Parameters
path
string
Una sèrie que conté el camí al fitxer des del qual es pot crear el Aspose.Note.AttachedFile.
AttachedFile(Títol: Stream, ImageFormat)
Inicialitza una nova instància de la classe Aspose.Note.AttachedFile.
public AttachedFile(string path, Stream icon, ImageFormat iconFormat)
Parameters
path
string
Una sèrie que conté el camí al fitxer des del qual es pot crear el Aspose.Note.AttachedFile.
icon
Stream
Una icona per al fitxer afegit.
iconFormat
ImageFormat
Un format de l’icona de fitxer afegit.
AttachedFile(Tàrrega, Tàrrega)
Inicialitza una nova instància de la classe Aspose.Note.AttachedFile.
public AttachedFile(string fileName, Stream attachedFileStream)
Parameters
fileName
string
Nom del fitxer afegit.
attachedFileStream
Stream
Un corrent que conté els bytes de fitxers afegits.
AttachedFile(Títol: Stream, stream, ImageFormat)
Inicialitza una nova instància de la classe Aspose.Note.AttachedFile.
public AttachedFile(string fileName, Stream attachedFileStream, Stream icon, ImageFormat iconFormat)
Parameters
fileName
string
Nom del fitxer afegit.
attachedFileStream
Stream
Un corrent que conté els bytes de fitxers afegits.
icon
Stream
Una icona per al fitxer afegit.
iconFormat
ImageFormat
Un format de l’icona de fitxer afegit.
AttachedFile()
Inicialitza una nova instància de la classe Aspose.Note.AttachedFile.
public AttachedFile()
Properties
Alignment
Obtenir o establir l’alineació.
public HorizontalAlignment Alignment { get; set; }
Valor de la propietat
AlternativeTextDescription
Obté o posa un cos un text alternatiu per a l’icona del fitxer afegit.
public string AlternativeTextDescription { get; set; }
Valor de la propietat
AlternativeTextTitle
Obté o estableix un títol de text alternatiu per a l’icona del fitxer afegit.
public string AlternativeTextTitle { get; set; }
Valor de la propietat
Bytes
Obté les dades binàries per a un fitxer incorporat.
public byte[] Bytes { get; }
Valor de la propietat
byte []
Examples
Mostra com obtenir el contingut d’un fitxer afegit.
// 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
Obté l’extensió d’un fitxer incorporat.
public string Extension { get; }
Valor de la propietat
FileName
Obté el nom del fitxer incorporat.
public string FileName { get; }
Valor de la propietat
FilePath
Obté el camí cap al fitxer original.
public string FilePath { get; }
Valor de la propietat
Height
Obté l’altura original de la icona de fitxer incorporat.
public float Height { get; }
Valor de la propietat
HorizontalOffset
Obté o col·loca el descompte horitzontal.
public float HorizontalOffset { get; set; }
Valor de la propietat
Icon
Obté les dades binàries per a l’icona que està associat amb el fitxer incorporat.
public byte[] Icon { get; }
Valor de la propietat
byte []
IconExtension
Obtenir l’extensió de la icona.
public string IconExtension { get; }
Valor de la propietat
IsPrintout
Obté o estableix un valor que indiqui si la vista del fitxer és imprimida.
public bool IsPrintout { get; set; }
Valor de la propietat
IsSizeSetByUser
Obté o estableix un valor que indiqui si el valor de la mida de l’icona ha estat explicitament actualitzat per l’usuari.
public bool IsSizeSetByUser { get; set; }
Valor de la propietat
LastModifiedTime
Obté o fixa l’últim temps modificat.
public DateTime LastModifiedTime { get; set; }
Valor de la propietat
MaxHeight
Obté o s’estableix la altura màxima per mostrar l’icona de fitxer incorporat.
public float MaxHeight { get; set; }
Valor de la propietat
MaxWidth
Obté o s’estableix la amplada màxima per mostrar l’icona de fitxer incorporat.
public float MaxWidth { get; set; }
Valor de la propietat
ParsingErrorInfo
Obté les dades sobre l’error que es va produir mentre accedeix al fitxer.
public ParsingErrorInfo ParsingErrorInfo { get; }
Valor de la propietat
Tags
Obté la llista de totes les etiquetes d’un paràgraf.
public List<itag> Tags { get; }
Valor de la propietat
Text
Obté o estableix la representació de text del fitxer embolicat. La barra NO ha de contenir cap caràcter del valor 10 (feu de línia) o 13 (revolució d’enviament).
public string Text { get; set; }
Valor de la propietat
VerticalOffset
Obté o posa la descomposició vertical.
public float VerticalOffset { get; set; }
Valor de la propietat
Width
Obté l’amplada original de la icona de fitxers incorporats.
public float Width { get; }
Valor de la propietat
Methods
Accept(DocumentVisitor)
Accepta el visitant del nucli.
public override void Accept(DocumentVisitor visitor)
Parameters
visitor
DocumentVisitor
L’objecte d’una classe derivat del Aspose.Note.DocumentVisitor.