Class AttachedFile
A név: Aspose.Note Összefoglaló: Aspose.Note.dll (25.4.0)
Egy hozzáadott fájlt képvisel.
public class AttachedFile : Node, IPageChildNode, IOutlineElementChildNode, ITaggable, INode
Inheritance
object ← Node ← AttachedFile
Implements
IPageChildNode , IOutlineElementChildNode , ITaggable , INode
Örökletes tagok
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
Megmutatja, hogyan lehet a hozzáadott fájl tartalmát megszerezni.
// 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>
Megmutatja, hogyan kell hozzáadni egy fájlt egy dokumentumhoz a filepath használatával.
// 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);
Megmutatja, hogyan kell hozzáadni egy fájlt egy áramból egy dokumentumhoz.
// 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(A string)
Kezdődik egy új példány a Aspose.Note.AttachedFile osztály.
public AttachedFile(string path)
Parameters
path
string
Egy sor, amely tartalmazza az utat a fájl, ahonnan létrehozni a Aspose.Note.AttachedFile.
AttachedFile(String, Stream és ImageFormat)
Kezdődik egy új példány a Aspose.Note.AttachedFile osztály.
public AttachedFile(string path, Stream icon, ImageFormat iconFormat)
Parameters
path
string
Egy sor, amely tartalmazza az utat a fájl, ahonnan létrehozni a Aspose.Note.AttachedFile.
icon
Stream
Egy ikon a hozzáadott fájlhoz.
iconFormat
ImageFormat
A hozzáadott fájl ikon formátumát.
AttachedFile(Áramlás, Stream)
Kezdődik egy új példány a Aspose.Note.AttachedFile osztály.
public AttachedFile(string fileName, Stream attachedFileStream)
Parameters
fileName
string
A hozzáadott fájl neve.
attachedFileStream
Stream
Egy áram, amely tartalmazza a hozzáadott fájl bajtokat.
AttachedFile(String, Stream, Áramlat, Képformátum)
Kezdődik egy új példány a Aspose.Note.AttachedFile osztály.
public AttachedFile(string fileName, Stream attachedFileStream, Stream icon, ImageFormat iconFormat)
Parameters
fileName
string
A hozzáadott fájl neve.
attachedFileStream
Stream
Egy áram, amely tartalmazza a hozzáadott fájl bajtokat.
icon
Stream
Egy ikon a hozzáadott fájlhoz.
iconFormat
ImageFormat
A hozzáadott fájl ikon formátumát.
AttachedFile()
Kezdődik egy új példány a Aspose.Note.AttachedFile osztály.
public AttachedFile()
Properties
Alignment
Megkapja vagy rögzíti az összehangolást.
public HorizontalAlignment Alignment { get; set; }
ingatlan értéke
AlternativeTextDescription
Megkapja vagy beállítja a testet egy alternatív szöveg a csatolt fájl ikonjához.
public string AlternativeTextDescription { get; set; }
ingatlan értéke
AlternativeTextTitle
Megkapja vagy beállítja az alternatív szöveg címét a csatolt fájl ikonjára.
public string AlternativeTextTitle { get; set; }
ingatlan értéke
Bytes
Megkapja a bináris adatokat egy beépített fájlhoz.
public byte[] Bytes { get; }
ingatlan értéke
byte []
Examples
Megmutatja, hogyan lehet a hozzáadott fájl tartalmát megszerezni.
// 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
Kap egy beépített fájl kiterjesztését.
public string Extension { get; }
ingatlan értéke
FileName
Megkapja a beépített fájl nevét.
public string FileName { get; }
ingatlan értéke
FilePath
Megkapja az utat az eredeti fájlhoz.
public string FilePath { get; }
ingatlan értéke
Height
Megkapja a beépített fájl ikon eredeti magasságát.
public float Height { get; }
ingatlan értéke
HorizontalOffset
Megkapja vagy beállítja a horizontális kedvezményt.
public float HorizontalOffset { get; set; }
ingatlan értéke
Icon
Megkapja a bináris adatokat az ikonhoz, amely a beépített fájlhoz kapcsolódik.
public byte[] Icon { get; }
ingatlan értéke
byte []
IconExtension
Megkapja az ikon kiterjesztését.
public string IconExtension { get; }
ingatlan értéke
IsPrintout
Megkap egy értéket vagy beállítást, amely azt jelzi, hogy a fájl megjelenése nyomtatott.
public bool IsPrintout { get; set; }
ingatlan értéke
IsSizeSetByUser
Megkapja vagy beállítja az értéket, amely azt jelzi, hogy a ikon mérete értéke kifejezetten frissült-e a felhasználó által.
public bool IsSizeSetByUser { get; set; }
ingatlan értéke
LastModifiedTime
Megkapja vagy beállítja az utolsó módosított időt.
public DateTime LastModifiedTime { get; set; }
ingatlan értéke
MaxHeight
Megkapja vagy beállítja a maximális magasságot a beépített fájl ikon megjelenítéséhez.
public float MaxHeight { get; set; }
ingatlan értéke
MaxWidth
Megkapja vagy beállítja a maximális szélességet a beépített fájl ikon megjelenítéséhez.
public float MaxWidth { get; set; }
ingatlan értéke
ParsingErrorInfo
Megkapja a fájlhoz való hozzáférés során bekövetkezett hiba adatait.
public ParsingErrorInfo ParsingErrorInfo { get; }
ingatlan értéke
Tags
Kapja meg a listát az összes tag egy bekezdés.
public List<itag> Tags { get; }
ingatlan értéke
Text
Megkapja vagy beállítja a beágyazott fájl szöveges képviseletét. A sor NEM tartalmaznia kell a 10 (line feed) vagy a 13 (carriage return) értéket tartalmazó karaktereket.
public string Text { get; set; }
ingatlan értéke
VerticalOffset
Megkapja vagy állítja a függőleges offset.
public float VerticalOffset { get; set; }
ingatlan értéke
Width
Megkapja a beépített fájl ikon eredeti szélességét.
public float Width { get; }
ingatlan értéke
Methods
Accept(DocumentVisitor)
Elfogadja a csomópont látogatóját.
public override void Accept(DocumentVisitor visitor)
Parameters
visitor
DocumentVisitor
Az osztály tárgya a Aspose.Note.DocumentVisitor származik.