Class AttachedFile
Название пространства: Aspose.Note Ассоциация: Aspose.Note.dll (25.4.0)
Представляет приложенный файл.
public class AttachedFile : Node, IPageChildNode, IOutlineElementChildNode, ITaggable, INode
Inheritance
object ← Node ← AttachedFile
Implements
IPageChildNode , IOutlineElementChildNode , ITaggable , INode
Наследованные члены
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
Показать, как получить контент прикрепленного файла.
// 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>
Показать, как добавить файл к документу, используя файловый путь.
// 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);
Показывает, как добавить файл из потока в документ.
// 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(Стриг)
Инициализует новую инстанцию класса Aspose.Note.AttachedFile.
public AttachedFile(string path)
Parameters
path
string
Шрифт, который содержит путь к файлу, с которого можно создать Aspose.Note.AttachedFile.
AttachedFile(Стриг, Stream, ImageFormat)
Инициализует новую инстанцию класса Aspose.Note.AttachedFile.
public AttachedFile(string path, Stream icon, ImageFormat iconFormat)
Parameters
path
string
Шрифт, который содержит путь к файлу, с которого можно создать Aspose.Note.AttachedFile.
icon
Stream
Икона для прикрепленного файла.
iconFormat
ImageFormat
Формат прикрепленной файловой иконы.
AttachedFile(Стрем , Stream)
Инициализует новую инстанцию класса Aspose.Note.AttachedFile.
public AttachedFile(string fileName, Stream attachedFileStream)
Parameters
fileName
string
Название прикрепленного файла.
attachedFileStream
Stream
Сток, который содержит прикрепленные байты файла.
AttachedFile(Стрий, поток, поток, ImageFormat)
Инициализует новую инстанцию класса Aspose.Note.AttachedFile.
public AttachedFile(string fileName, Stream attachedFileStream, Stream icon, ImageFormat iconFormat)
Parameters
fileName
string
Название прикрепленного файла.
attachedFileStream
Stream
Сток, который содержит прикрепленные байты файла.
icon
Stream
Икона для прикрепленного файла.
iconFormat
ImageFormat
Формат прикрепленной файловой иконы.
AttachedFile()
Инициализует новую инстанцию класса Aspose.Note.AttachedFile.
public AttachedFile()
Properties
Alignment
Получить или установить корректировку.
public HorizontalAlignment Alignment { get; set; }
Стоимость недвижимости
AlternativeTextDescription
Получается или устанавливается альтернативный текст для иконы прикрепленного файла.
public string AlternativeTextDescription { get; set; }
Стоимость недвижимости
AlternativeTextTitle
Получается или устанавливается заголовок альтернативного текста для иконы прикрепленного файла.
public string AlternativeTextTitle { get; set; }
Стоимость недвижимости
Bytes
Получает бинарные данные для встроенного файла.
public byte[] Bytes { get; }
Стоимость недвижимости
byte [ ]
Examples
Показать, как получить контент прикрепленного файла.
// 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
Получается расширение встроенного файла.
public string Extension { get; }
Стоимость недвижимости
FileName
Получить название встроенного файла.
public string FileName { get; }
Стоимость недвижимости
FilePath
Получите путь к оригинальному файлу.
public string FilePath { get; }
Стоимость недвижимости
Height
Получается первоначальная высота встроенной файловой иконы.
public float Height { get; }
Стоимость недвижимости
HorizontalOffset
Получается или устанавливается горизонтальное возмещение.
public float HorizontalOffset { get; set; }
Стоимость недвижимости
Icon
Получает бинарные данные для иконы, которая связана с встроенным файлом.
public byte[] Icon { get; }
Стоимость недвижимости
byte [ ]
IconExtension
Получается расширение иконы.
public string IconExtension { get; }
Стоимость недвижимости
IsPrintout
Получается или устанавливается значение, указывающее на то, является ли изображение файла печатным.
public bool IsPrintout { get; set; }
Стоимость недвижимости
IsSizeSetByUser
Получается или устанавливается значение, указывающее на то, было ли значение размера иконы изрично обновлено пользователем.
public bool IsSizeSetByUser { get; set; }
Стоимость недвижимости
LastModifiedTime
Получается или устанавливается последнее модифицированное время.
public DateTime LastModifiedTime { get; set; }
Стоимость недвижимости
MaxHeight
Получается или устанавливается максимальная высота для отображения встроенной иконы файла.
public float MaxHeight { get; set; }
Стоимость недвижимости
MaxWidth
Получает или устанавливает максимальную ширину для отображения встроенной иконы файла.
public float MaxWidth { get; set; }
Стоимость недвижимости
ParsingErrorInfo
Получается информация о ошибке, произошедшей при доступе к файлу.
public ParsingErrorInfo ParsingErrorInfo { get; }
Стоимость недвижимости
Tags
Получается перечень всех знаков параграфа.
public List<itag> Tags { get; }
Стоимость недвижимости
Text
Получается или устанавливается текстовое представление встроенного файла. строка НЕ должна содержать каких-либо символов значения 10 (линейный корм) или 13 (вторжение нагрузки).
public string Text { get; set; }
Стоимость недвижимости
VerticalOffset
Получить или установить вертикальный отпуск.
public float VerticalOffset { get; set; }
Стоимость недвижимости
Width
Получает оригинальную ширину встроенной файловой иконы.
public float Width { get; }
Стоимость недвижимости
Methods
Accept(DocumentVisitor)
Принимает посетителя нода.
public override void Accept(DocumentVisitor visitor)
Parameters
visitor
DocumentVisitor
Объект класса, полученный из Aspose.Note.DocumentVisitor.