Class AttachedFile
Pôvodný názov: Aspose.Note Zhromaždenie: Aspose.Note.dll (25.4.0)
Predstavuje pripojený súbor.
public class AttachedFile : Node, IPageChildNode, IOutlineElementChildNode, ITaggable, INode
Inheritance
object ← Node ← AttachedFile
Implements
IPageChildNode , IOutlineElementChildNode , ITaggable , INode
Z dedičných členov
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
Ukáže, ako získať obsah pripojeného súboru.
// 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>
Ukázať, ako pridať súbor do dokumentu pomocou priečinka.
// 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);
Ukáže, ako pridať súbor z prúdu do dokumentu.
// 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(Stretnutie)
Initalizuje novú inštanciu triedy Aspose.Note.AttachedFile.
public AttachedFile(string path)
Parameters
path
string
Stránka, ktorá obsahuje cestu do súboru, z ktorého vytvoriť Aspose.Note.AttachedFile.
AttachedFile(String, Stream a ImageFormat)
Initalizuje novú inštanciu triedy Aspose.Note.AttachedFile.
public AttachedFile(string path, Stream icon, ImageFormat iconFormat)
Parameters
path
string
Stránka, ktorá obsahuje cestu do súboru, z ktorého vytvoriť Aspose.Note.AttachedFile.
icon
Stream
Ikon pre pripojený súbor.
iconFormat
ImageFormat
Formát pridanej ikony súboru.
AttachedFile(Stream , Stream)
Initalizuje novú inštanciu triedy Aspose.Note.AttachedFile.
public AttachedFile(string fileName, Stream attachedFileStream)
Parameters
fileName
string
Názov pripojeného súboru.
attachedFileStream
Stream
Stream, ktorý obsahuje pripojené súborové bajty.
AttachedFile(String, Stream, Prúd, ImageFormat)
Initalizuje novú inštanciu triedy Aspose.Note.AttachedFile.
public AttachedFile(string fileName, Stream attachedFileStream, Stream icon, ImageFormat iconFormat)
Parameters
fileName
string
Názov pripojeného súboru.
attachedFileStream
Stream
Stream, ktorý obsahuje pripojené súborové bajty.
icon
Stream
Ikon pre pripojený súbor.
iconFormat
ImageFormat
Formát pridanej ikony súboru.
AttachedFile()
Initalizuje novú inštanciu triedy Aspose.Note.AttachedFile.
public AttachedFile()
Properties
Alignment
Dostane alebo nastaví zosúladenie.
public HorizontalAlignment Alignment { get; set; }
Hodnota nehnuteľnosti
AlternativeTextDescription
Dostane alebo nastaví telo alternatívny text pre ikonu pripojeného súboru.
public string AlternativeTextDescription { get; set; }
Hodnota nehnuteľnosti
AlternativeTextTitle
Získava alebo nastaví názov alternatívneho textu pre ikonu pripojeného súboru.
public string AlternativeTextTitle { get; set; }
Hodnota nehnuteľnosti
Bytes
Získava binárne údaje pre vstavaný súbor.
public byte[] Bytes { get; }
Hodnota nehnuteľnosti
byte []
Examples
Ukáže, ako získať obsah pripojeného súboru.
// 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
Dostane rozšírenie vloženého súboru.
public string Extension { get; }
Hodnota nehnuteľnosti
FileName
Získa názov vloženého súboru.
public string FileName { get; }
Hodnota nehnuteľnosti
FilePath
Získajte cestu k pôvodnému súboru.
public string FilePath { get; }
Hodnota nehnuteľnosti
Height
Získava pôvodnú výšku vstavaného ikony súboru.
public float Height { get; }
Hodnota nehnuteľnosti
HorizontalOffset
Získajte alebo nastavíte horizontálnu náhradu.
public float HorizontalOffset { get; set; }
Hodnota nehnuteľnosti
Icon
Získava binárne údaje pre ikonu, ktorá je spojená s vloženým súborom.
public byte[] Icon { get; }
Hodnota nehnuteľnosti
byte []
IconExtension
Získajte rozšírenie ikony.
public string IconExtension { get; }
Hodnota nehnuteľnosti
IsPrintout
Získa alebo nastaví hodnotu, ktorá ukazuje, či je zobrazenie súboru tlačené.
public bool IsPrintout { get; set; }
Hodnota nehnuteľnosti
IsSizeSetByUser
Dostane alebo nastaví hodnotu, ktorá naznačuje, či je hodnota veľkosti ikony výslovne aktualizovaná používateľom.
public bool IsSizeSetByUser { get; set; }
Hodnota nehnuteľnosti
LastModifiedTime
Dostane alebo nastaví poslednú modifikovanú dobu.
public DateTime LastModifiedTime { get; set; }
Hodnota nehnuteľnosti
MaxHeight
Získajte alebo nastavíte maximálnu výšku na zobrazenie vstavaného ikony súboru.
public float MaxHeight { get; set; }
Hodnota nehnuteľnosti
MaxWidth
Získajte alebo nastavíte maximálnu šírku na zobrazenie vstavaného ikony súboru.
public float MaxWidth { get; set; }
Hodnota nehnuteľnosti
ParsingErrorInfo
Získava údaje o chybách, ktoré sa vyskytli počas prístupu k súboru.
public ParsingErrorInfo ParsingErrorInfo { get; }
Hodnota nehnuteľnosti
Tags
Získajte zoznam všetkých značiek jedného odseku.
public List<itag> Tags { get; }
Hodnota nehnuteľnosti
Text
Obdržíte alebo nastavíte textovú reprezentáciu vloženého súboru. riadok NEMU obsahovať žiadne znaky hodnoty 10 (line feed) alebo 13 (vrátenie nákladu).
public string Text { get; set; }
Hodnota nehnuteľnosti
VerticalOffset
Získajte alebo nastavíte vertikálny offset.
public float VerticalOffset { get; set; }
Hodnota nehnuteľnosti
Width
Získava pôvodnú šírku vstavaného ikony súboru.
public float Width { get; }
Hodnota nehnuteľnosti
Methods
Accept(DocumentVisitor)
Prijíma návštevníka uzla.
public override void Accept(DocumentVisitor visitor)
Parameters
visitor
DocumentVisitor
Objekt triedy je odvodený z Aspose.Note.DocumentVisitor.