Class AttachedFile
Название пространства: Aspose.Note Ассоциация: Aspose.Note.dll (25.4.0)
Представляет приложенный файл.
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
Наследованные члены
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
Показать, как получить контент прикрепленного файла.
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);
}
}
}
Показать, как добавить файл к документу, используя файловый путь.
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);
Показывает, как добавить файл из потока в документ.
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
Скриншоты (String )
Инициализует новую инстанцию класса Aspose.Note.AttachedFile.
public AttachedFile(string path)
{
}
Parameters
path
string
Шрифт, который содержит путь к файлу, с которого можно создать Aspose.Note.AttachedFile.
AttachedFile (string, Stream и ImageFormat)
Инициализует новую инстанцию класса Aspose.Note.AttachedFile.
public AttachedFile(string path, Stream icon, ImageFormat iconFormat)
{
}
Parameters
path
string
Шрифт, который содержит путь к файлу, с которого можно создать Aspose.Note.AttachedFile.
icon
Stream
Икона для прикрепленного файла.
iconFormat
ImageFormat
Формат прикрепленной файловой иконы.
Присоединенные файлы (string, stream)
Инициализует новую инстанцию класса Aspose.Note.AttachedFile.
public AttachedFile(string fileName, Stream attachedFileStream)
{
}
Parameters
fileName
string
Название прикрепленного файла.
attachedFileStream
Stream
Сток, который содержит прикрепленные байты файла.
AttachedFile (string, stream, Stream, ImageFormat)
Инициализует новую инстанцию класса Aspose.Note.AttachedFile.
public AttachedFile(
string fileName,
Stream attachedFileStream,
Stream icon,
ImageFormat iconFormat)
{
}
Parameters
fileName
string
Название прикрепленного файла.
attachedFileStream
Stream
Сток, который содержит прикрепленные байты файла.
icon
Stream
Икона для прикрепленного файла.
iconFormat
ImageFormat
Формат прикрепленной файловой иконы.
Соблюдение ( )
Инициализует новую инстанцию класса 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
Показать, как получить контент прикрепленного файла.
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
Получается расширение встроенного файла.
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 { return this._text; }
set { this._text = value; }
}
private string _text;
Стоимость недвижимости
VerticalOffset
Получить или установить вертикальный отпуск.
public float VerticalOffset
{
get;
set;
}
Стоимость недвижимости
Width
Получает оригинальную ширину встроенной файловой иконы.
public float Width
{
get;
}
Стоимость недвижимости
Methods
Принятие документа (Document Visitor)
Принимает посетителя нода.
public override void Accept(DocumentVisitor visitor)
{
}
Parameters
visitor
DocumentVisitor
Объект класса, полученный из Aspose.Note.DocumentVisitor.