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
{
private string _path;
public string Path
{
get { return this._path; }
set { this._path = value; }
}
}
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.
string dataDir = RunExamples.GetDataDir_Attachments();
Document oneFile = new Document(dataDir + "Sample1.one");
IList<attachedfile> nodes = oneFile.GetChildNodes<attachedfile>();
foreach (AttachedFile file in nodes)
{
using (Stream outputStream = new MemoryStream(file.Bytes))
{
using (System.IO.FileStream fileStream = System.IO.File.OpenWrite(String.Format(dataDir + file.FileName)))
{
CopyStream(outputStream, fileStream);
}
}
}
Mostra com afegir un fitxer a un document utilitzant la ruta de fitxers.
string dataDir = RunExamples.GetDataDir_Attachments();
Document doc = new Document();
Aspose.Note.Page page = new Aspose.Note.Page(doc);
Outline outline = new Outline(doc);
OutlineElement outlineElem = new OutlineElement(doc);
AttachedFile attachedFile = new AttachedFile(doc, dataDir + "attachment.txt");
outlineElem.AppendChildLast(attachedFile);
outline.AppendChildLast(outlineElem);
page.AppendChildLast(outline);
doc.AppendChildLast(page);
dataDir += "AttachFileByPath_out.one";
doc.Save(dataDir);
Mostra com afegir un fitxer d’un flux a un document.
string dataDir = RunExamples.GetDataDir_Attachments();
Document doc = new Document();
Aspose.Note.Page page = new Aspose.Note.Page(doc);
Outline outline = new Outline(doc);
OutlineElement outlineElem = new OutlineElement(doc);
using (var stream = File.OpenRead(dataDir + "icon.jpg"))
{
AttachedFile attachedFile = new AttachedFile(doc, dataDir + "attachment.txt", stream, ImageFormat.Jpeg);
outlineElem.AppendChildLast(attachedFile);
}
outline.AppendChildLast(outlineElem);
page.AppendChildLast(outline);
doc.AppendChildLast(page);
dataDir += "AttachFileAndSetIcon_out.one";
doc.Save(dataDir);
Constructors
Enllaç (string )
Inicia 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 l’Aspose.Note.AttachedFile.
AttachedFile (string, Stream i ImageFormat)
Inicia 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 l’Aspose.Note.AttachedFile.
icon
Stream
Una icona per al fitxer afegit.
iconFormat
ImageFormat
Un format de l’icona de fitxer afegit.
Arxiu (string i flux)
Inicia 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 (string, Stream, stream, ImageFormat)
Inicia 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.
Títol d’actuació ()
Inicia 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.
string dataDir = RunExamples.GetDataDir_Attachments();
Document oneFile = new Document(dataDir + "Sample1.one");
IList<attachedfile> nodes = oneFile.GetChildNodes<attachedfile>();
foreach (AttachedFile file in nodes)
{
using (Stream outputStream = new MemoryStream(file.Bytes))
{
using (System.IO.FileStream fileStream = System.IO.File.OpenWrite(String.Format(dataDir + file.FileName)))
{
CopyStream(outputStream, fileStream);
}
}
}
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 { return this._text; }
set { this._text = value; }
}
private string _text;
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
Acceptació (DocumentVisitor)
Accepta el visitant del nucli.
public override void Accept(DocumentVisitor visitor)
{
}
Parameters
visitor
DocumentVisitor
L’objecte d’una classe derivada de l’Aspose.Note.DocumentVisitor.