Class AttachedFile
Nazwa przestrzeń: Aspose.Note Zgromadzenie: Aspose.Note.dll (25.4.0)
Przedstawia załączony plik.
public class AttachedFile : Node, IPageChildNode, IOutlineElementChildNode, ITaggable, INode
Inheritance
object ← Node ← AttachedFile
Implements
IPageChildNode , IOutlineElementChildNode , ITaggable , INode
Dziedziczeni członkowie
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
Pokaż, jak uzyskać zawartość załączonego pliku.
// 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>
Pokaż, jak dodać plik do dokumentu za pomocą ścieżki pliku.
// 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);
Pokaż, jak dodać plik z strumienia 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(strumień)
Inicjalizuje nową instancję klasy Aspose.Note.AttachedFile.
public AttachedFile(string path)
Parameters
path
string
Strona, która zawiera ścieżkę do pliku, z którego można utworzyć Aspose.Note.AttachedFile.
AttachedFile(String, strumień, ImageFormat)
Inicjalizuje nową instancję klasy Aspose.Note.AttachedFile.
public AttachedFile(string path, Stream icon, ImageFormat iconFormat)
Parameters
path
string
Strona, która zawiera ścieżkę do pliku, z którego można utworzyć Aspose.Note.AttachedFile.
icon
Stream
Ikonę do załączonego pliku.
iconFormat
ImageFormat
Format załączonej ikony pliku.
AttachedFile(strumień, strumień)
Inicjalizuje nową instancję klasy Aspose.Note.AttachedFile.
public AttachedFile(string fileName, Stream attachedFileStream)
Parameters
fileName
string
Nazwa załączonego pliku.
attachedFileStream
Stream
Strumień, który zawiera załączone bajty pliku.
AttachedFile(Strumień, Stream, ImageFormat)
Inicjalizuje nową instancję klasy Aspose.Note.AttachedFile.
public AttachedFile(string fileName, Stream attachedFileStream, Stream icon, ImageFormat iconFormat)
Parameters
fileName
string
Nazwa załączonego pliku.
attachedFileStream
Stream
Strumień, który zawiera załączone bajty pliku.
icon
Stream
Ikonę do załączonego pliku.
iconFormat
ImageFormat
Format załączonej ikony pliku.
AttachedFile()
Inicjalizuje nową instancję klasy Aspose.Note.AttachedFile.
public AttachedFile()
Properties
Alignment
Dostęp lub ustawienie dostosowania.
public HorizontalAlignment Alignment { get; set; }
Wartość nieruchomości
AlternativeTextDescription
Otrzymuje lub ustawia ciało alternatywny tekst dla ikony załączonego pliku.
public string AlternativeTextDescription { get; set; }
Wartość nieruchomości
AlternativeTextTitle
Otrzymuje lub ustawia tytuł alternatywnego tekstu dla ikony załączonego pliku.
public string AlternativeTextTitle { get; set; }
Wartość nieruchomości
Bytes
Otrzymuje dane binarne dla wbudowanego pliku.
public byte[] Bytes { get; }
Wartość nieruchomości
byte [ ]
Examples
Pokaż, jak uzyskać zawartość załączonego pliku.
// 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
Otrzymuje rozszerzenie wbudowanego pliku.
public string Extension { get; }
Wartość nieruchomości
FileName
Otrzymuje nazwę wbudowanego pliku.
public string FileName { get; }
Wartość nieruchomości
FilePath
Dostaje drogę do oryginalnego pliku.
public string FilePath { get; }
Wartość nieruchomości
Height
Otrzymuje oryginalną wysokość wbudowanej ikony pliku.
public float Height { get; }
Wartość nieruchomości
HorizontalOffset
Zostaw lub ustaw horyzontalny odsetek.
public float HorizontalOffset { get; set; }
Wartość nieruchomości
Icon
Otrzymuje dane binarne dla ikony, która jest powiązana z wbudowanym plikiem.
public byte[] Icon { get; }
Wartość nieruchomości
byte [ ]
IconExtension
Poznaj rozszerzenie ikony.
public string IconExtension { get; }
Wartość nieruchomości
IsPrintout
Otrzymuje lub ustawia wartość wskazującą, czy widok pliku jest drukowany.
public bool IsPrintout { get; set; }
Wartość nieruchomości
IsSizeSetByUser
Otrzymuje lub ustawia wartość wskazującą, czy wielkość ikony została wyraźnie zaktualizowana przez użytkownika.
public bool IsSizeSetByUser { get; set; }
Wartość nieruchomości
LastModifiedTime
Otrzymuje lub ustawia ostatnią zmienioną godzinę.
public DateTime LastModifiedTime { get; set; }
Wartość nieruchomości
MaxHeight
Otrzymuje lub ustawia maksymalną wysokość, aby wyświetlić wbudowaną ikonę pliku.
public float MaxHeight { get; set; }
Wartość nieruchomości
MaxWidth
Otrzymuje lub ustawia maksymalną szerokość, aby wyświetlić wbudowaną ikonę pliku.
public float MaxWidth { get; set; }
Wartość nieruchomości
ParsingErrorInfo
Otrzymuje dane dotyczące błędu, który wystąpił podczas dostępu do pliku.
public ParsingErrorInfo ParsingErrorInfo { get; }
Wartość nieruchomości
Tags
Otrzymuje listę wszystkich etykiet paragrafu.
public List<itag> Tags { get; }
Wartość nieruchomości
Text
Plik NIE MOŻE zawierać żadnych znaków wartości 10 (kwas linii) lub 13 (powrót ładowania).
public string Text { get; set; }
Wartość nieruchomości
VerticalOffset
Uzyskuje lub ustawia opłatę pionową.
public float VerticalOffset { get; set; }
Wartość nieruchomości
Width
Otrzymuje oryginalną szerokość wbudowanej ikony pliku.
public float Width { get; }
Wartość nieruchomości
Methods
Accept(DocumentVisitor)
Przyjmuje odwiedzającego węzła.
public override void Accept(DocumentVisitor visitor)
Parameters
visitor
DocumentVisitor
Obiekt klasy pochodzi z Aspose.Note.DocumentVisitor.