BuiltInDocumentProperty Enumeration |
Represents an available built-in document properties.
Namespace: SautinSoft.DocumentAssembly: SautinSoft.Document (in SautinSoft.Document.dll) Version: 2024.11.20
Syntax public enum BuiltInDocumentProperty
Public Enumeration BuiltInDocumentProperty
Members Member name | Value | Description |
---|
Title | 0 |
Title of the document.
|
Author | 1 |
Name of the document's author.
|
Subject | 2 |
Subject of the document.
|
Comments | 3 |
Document comments.
|
DateContentCreated | 4 |
UTC time of creation of the document.
|
DateLastSaved | 5 |
UTC time on which the document was last modified/saved.
|
Category | 6 |
Category of the document.
|
Status | 7 |
Status of the document.
|
Keywords | 8 |
Document keywords.
|
LastSavedBy | 9 |
Name of the last author.
|
Manager | 10 |
Manager.
|
Company | 11 |
Company.
|
HyperlinkBase | 12 |
Base hyperlink.
|
Pages | 13 |
Total number of pages.
|
Words | 14 |
Total number of words.
|
Characters | 15 |
Total number of characters except spaces.
|
CharactersWithSpaces | 16 |
Total number of characters with spaces.
|
Lines | 17 |
Total number of lines.
|
Paragraphs | 18 |
Total number of paragraphs.
|
Creator | 19 |
Only for PDF. If the document was converted to PDF from another format, the name of the application (for example, Adobe FrameMaker®) that created the original document from which it was converted.
|
Producer | 20 |
Only for PDF. If the document was converted to PDF from another format, the name of the application (for example, Acrobat Distiller) that converted it to PDF.
|
Example See Developer Guide: Create a new document (DOCX) with some built-in properties
Create a new document (DOCX) with some built-in properties using C#
using System;
using SautinSoft.Document;
using SautinSoft.Document.Drawing;
using System.IO;
using System.Linq;
namespace Example
{
class Program
{
static void Main(string[] args)
{
CreateDocumentProperties();
ReadDocumentProperties();
}
public static void CreateDocumentProperties()
{
string filePath = @"..\..\..\DocumentProperties.docx";
DocumentCore dc = new DocumentCore();
dc.Content.End.Insert("Hello World!!!", new CharacterFormat() { FontName = "Verdana", Size = 65.5f, FontColor = Color.Orange });
dc.Document.Properties.BuiltIn[BuiltInDocumentProperty.Title] = "How to add document properties. It works with DOCX, RTF, PDF, HTML etc";
dc.Document.Properties.BuiltIn[BuiltInDocumentProperty.Company] = "SautinSoft";
dc.Document.Properties.BuiltIn[BuiltInDocumentProperty.Author] = "John Smith";
dc.Document.Properties.BuiltIn[BuiltInDocumentProperty.Subject] = "Document .Net";
dc.Document.Properties.BuiltIn[BuiltInDocumentProperty.Keywords] = "reader, writer, docx, pdf, html, rtf, text";
dc.Document.Properties.BuiltIn[BuiltInDocumentProperty.HyperlinkBase] = "www.sautinsoft.com";
dc.Document.Properties.BuiltIn[BuiltInDocumentProperty.Manager] = "Alex Dickard";
dc.Document.Properties.BuiltIn[BuiltInDocumentProperty.Category] = "Document Object Model (DOM)";
dc.Document.Properties.BuiltIn[BuiltInDocumentProperty.DateContentCreated] =
new DateTime(2010, 1, 10).ToString();
dc.Document.Properties.BuiltIn[BuiltInDocumentProperty.DateLastSaved] =
DateTime.Now.ToString();
dc.CalculateStats();
dc.Save(filePath);
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(filePath) { UseShellExecute = true });
}
public static void ReadDocumentProperties()
{
string inpFile = @"..\..\..\DocumentProperties.docx";
string statFile = @"..\..\..\Statistics.pdf";
DocumentCore dc = DocumentCore.Load(inpFile);
dc.Document.Properties.Custom.Add("Producer", "My Producer");
Paragraph builtInPara = new Paragraph(dc,
new Run(dc, "Built-in document properties:"),
new SpecialCharacter(dc, SpecialCharacterType.LineBreak));
builtInPara.ParagraphFormat.Alignment = HorizontalAlignment.Left;
foreach (var docProp in dc.Document.Properties.BuiltIn)
{
builtInPara.Inlines.Add(
new Run(dc, string.Format("{0}: {1}", docProp.Key, docProp.Value)));
builtInPara.Inlines.Add(new SpecialCharacter(dc, SpecialCharacterType.LineBreak));
}
Paragraph customPropPara = new Paragraph(dc,
new Run(dc, "Custom document properties:"),
new SpecialCharacter(dc, SpecialCharacterType.LineBreak));
customPropPara.ParagraphFormat.Alignment = HorizontalAlignment.Left;
foreach (var docProp in dc.Document.Properties.Custom)
{
customPropPara.Inlines.Add(
new Run(dc, string.Format("{0}: {1} (Type: {2})", docProp.Key, docProp.Value, docProp.Value.GetType())));
customPropPara.Inlines.Add(new SpecialCharacter(dc, SpecialCharacterType.LineBreak));
}
dc.Sections.Clear();
dc.Sections.Add(new Section(dc, builtInPara, customPropPara));
dc.Save(statFile, new PdfSaveOptions());
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(statFile) { UseShellExecute = true });
}
}
}
Create a new document (DOCX) with some built-in properties using VB.Net
Option Infer On
Imports System
Imports System.IO
Imports SautinSoft.Document
Imports System.Linq
Module Sample
Sub Main()
CreateDocumentProperties()
ReadDocumentProperties()
End Sub
Sub CreateDocumentProperties()
Dim filePath As String = "..\..\..\DocumentProperties.docx"
Dim dc As New DocumentCore()
dc.Content.End.Insert("Hello World!!!", New CharacterFormat() With {
.FontName = "Verdana",
.Size = 65.5F,
.FontColor = Color.Orange
})
dc.Document.Properties.BuiltIn(BuiltInDocumentProperty.Title) = "How to add document properties. It works with DOCX, RTF, PDF, HTML etc"
dc.Document.Properties.BuiltIn(BuiltInDocumentProperty.Company) = "SautinSoft"
dc.Document.Properties.BuiltIn(BuiltInDocumentProperty.Author) = "John Smith"
dc.Document.Properties.BuiltIn(BuiltInDocumentProperty.Subject) = "Document .Net"
dc.Document.Properties.BuiltIn(BuiltInDocumentProperty.Keywords) = "reader, writer, docx, pdf, html, rtf, text"
dc.Document.Properties.BuiltIn(BuiltInDocumentProperty.HyperlinkBase) = "www.sautinsoft.com"
dc.Document.Properties.BuiltIn(BuiltInDocumentProperty.Manager) = "Alex Dickard"
dc.Document.Properties.BuiltIn(BuiltInDocumentProperty.Category) = "Document Object Model (DOM)"
dc.Document.Properties.BuiltIn(BuiltInDocumentProperty.DateContentCreated) = (New Date(2010, 1, 10)).ToString()
dc.Document.Properties.BuiltIn(BuiltInDocumentProperty.DateLastSaved) = Date.Now.ToString()
dc.CalculateStats()
dc.Save(filePath)
System.Diagnostics.Process.Start(New System.Diagnostics.ProcessStartInfo(filePath) With {.UseShellExecute = True})
End Sub
Sub ReadDocumentProperties()
Dim inpFile As String = "..\..\..\DocumentProperties.docx"
Dim statFile As String = "..\..\..\Statistics.pdf"
Dim dc As DocumentCore = DocumentCore.Load(inpFile)
dc.Document.Properties.Custom.Add("Producer", "My Producer")
Dim builtInPara As New Paragraph(dc, New Run(dc, "Built-in document properties:"), New SpecialCharacter(dc, SpecialCharacterType.LineBreak))
builtInPara.ParagraphFormat.Alignment = HorizontalAlignment.Left
For Each docProp In dc.Document.Properties.BuiltIn
builtInPara.Inlines.Add(New Run(dc, String.Format("{0}: {1}", docProp.Key, docProp.Value)))
builtInPara.Inlines.Add(New SpecialCharacter(dc, SpecialCharacterType.LineBreak))
Next docProp
Dim customPropPara As New Paragraph(dc, New Run(dc, "Custom document properties:"), New SpecialCharacter(dc, SpecialCharacterType.LineBreak))
customPropPara.ParagraphFormat.Alignment = HorizontalAlignment.Left
For Each docProp In dc.Document.Properties.Custom
customPropPara.Inlines.Add(New Run(dc, String.Format("{0}: {1} (Type: {2})", docProp.Key, docProp.Value, docProp.Value.GetType())))
customPropPara.Inlines.Add(New SpecialCharacter(dc, SpecialCharacterType.LineBreak))
Next docProp
dc.Sections.Clear()
dc.Sections.Add(New Section(dc, builtInPara, customPropPara))
dc.Save(statFile, New PdfSaveOptions())
System.Diagnostics.Process.Start(New System.Diagnostics.ProcessStartInfo(statFile) With {.UseShellExecute = True})
End Sub
End Module
See Also