Document |
The DocumentCore type exposes the following members.
Name | Description | |
---|---|---|
![]() ![]() | DocumentCore | Initializes a new instance of the DocumentCore class. |
Name | Description | |
---|---|---|
![]() ![]() | Bookmarks | Gets the document bookmarks. |
![]() | Comments | Gets the document comments. |
![]() | CustomXmlParts | Gets the custom XML parts contained in this document. |
![]() ![]() | DefaultCharacterFormat | Gets or sets the default character format. |
![]() ![]() | DefaultParagraphFormat | Gets or sets the default paragraph format. |
![]() | EditProtection | Gets or sets the document protection settings used to restrict editing and formatting of document content. Supported in DOCX format. |
![]() | ElementType |
Gets the ElementType of this element instance.
(Overrides ElementElementType) |
![]() ![]() | MailMerge | Gets a MailMerge object that represents the mail merge functionality for the document. |
![]() ![]() | Properties | Gets the document properties. |
![]() ![]() | RenderRightToLeft | Gets or sets render right to left. (default false) |
![]() ![]() | Revisions | Gets a collection of revisions (tracked changes) that exist in this document. |
![]() ![]() | Sections | Gets a collection that represents all sections in the document. |
![]() ![]() ![]() | Serial | Obsolete. This property is obsolete, please use the method SetLicense(String). |
![]() | Settings | Gets or sets the document settings. |
![]() ![]() | Styles | Gets a collection of styles defined in the document. |
![]() | WriteProtection | Gets the document write protection options. Supported only in DOCX format. |
Name | Description | |
---|---|---|
![]() | CalculateListItems | Calculates the list items contained in this document. |
![]() | CalculateListItems(Boolean) | Calculates the list items contained in this document. |
![]() ![]() | CalculateStats | Calculates document's statistics (number of words, number of pages and etc). |
![]() | Clone | Clones this DocumentCore instance. |
![]() ![]() | GetPaginator | Gets the document paginator. |
![]() ![]() | GetPaginator(PaginatorOptions) | Gets the document paginator. |
![]() ![]() | ImportT(T, Boolean) | Imports (clones) the specified source element to this DocumentCore instance so it can be inserted into document content. |
![]() ![]() | ImportT(T, Boolean, ImportSession) | Imports (clones) the specified source element to this DocumentCore instance so it can be inserted into document content. |
![]() ![]() ![]() | Load(String) | Loads a document from a file with the specified path. |
![]() ![]() ![]() | Load(Stream, LoadOptions) | Loads a document from the specified stream. |
![]() ![]() ![]() | Load(String, LoadOptions) | Loads a document from a file or URL. |
![]() ![]() | Save(String) | Saves the document to a file with the specified path. Path must include file extension. |
![]() ![]() | Save(Stream, SaveOptions) | Saves the document in the specified stream. |
![]() ![]() | Save(String, SaveOptions) | Saves the document to a file with the specified path. |
![]() ![]() ![]() | SetLicense | Activate your copy after purchasing or use temporary license for delete trial message. ATTENTION: specify this property first of all before creating the instance of DocumentCore! Use it when you got own license. We offer two license types: Permanent license from sautinsoft.com and Temporary license from reg.sautinsoft.com. Have question? Ask us: support@sautinsoft.com. |
See Developer Guide: How to create a new document and saves it in a desired format
using SautinSoft.Document; namespace Example { class Program { static void Main(string[] args) { // You can create the same document by using 3 ways: // // + DocumentBuilder // + DOM directly // + DOM and ContentRange // // Choose any of them which you like. // Way 1: CreateUsingDocumentBuilder(); // Way 2: CreateUsingDOM(); // Way 3: CreateUsingContentRange(); } /// <summary> /// Creates a new document using DocumentBuilder and saves it in a desired format. /// </summary> /// <remarks> /// Details: https://www.sautinsoft.com/products/document/help/net/developer-guide/create-document.php /// </remarks> static void CreateUsingDocumentBuilder() { // Create a new document and DocumentBuilder. DocumentCore dc = new DocumentCore(); DocumentBuilder db = new DocumentBuilder(dc); // Specify the formatting and insert text. db.CharacterFormat.FontName = "Verdana"; db.CharacterFormat.Size = 65.5f; db.CharacterFormat.FontColor = Color.Orange; db.Write("Hello World!"); // Save the document in DOCX format. string outFile = "DocumentBuilder.docx"; dc.Save(outFile); // Open the result for demonstration purposes. System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(outFile) { UseShellExecute = true }); } /// <summary> /// Creates a new document using DOM and saves it in a desired format. /// </summary> /// <remarks> /// Details: https://www.sautinsoft.com/products/document/help/net/developer-guide/create-document.php /// </remarks> static void CreateUsingDOM() { // Create a new document. DocumentCore dc = new DocumentCore(); // Create a new section, // add the section the document. Section sect = new Section(dc); dc.Sections.Add(sect); // Create a new paragraph, // add the paragraph to the section. Paragraph par = new Paragraph(dc); sect.Blocks.Add(par); // Create a new run (text object), // add the run to the paragraph. Run run = new Run(dc, "Hello World!"); run.CharacterFormat.FontName = "Verdana"; run.CharacterFormat.Size = 65.5f; run.CharacterFormat.FontColor = Color.Orange; par.Inlines.Add(run); // Save the document in PDF format. string outFile = @"DOM.pdf"; dc.Save(outFile); // Open the result for demonstration purposes. System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(outFile) { UseShellExecute = true }); } /// <summary> /// Creates a new document using DOM and ContentRange and saves it in a desired format. /// </summary> /// <remarks> /// Details: https://www.sautinsoft.com/products/document/help/net/developer-guide/create-document.php /// </remarks> static void CreateUsingContentRange() { // Create a new document. DocumentCore dc = new DocumentCore(); // Insert the formatted text into the document. dc.Content.End.Insert("Hello World!", new CharacterFormat() { FontName = "Verdana", Size = 65.5f, FontColor = Color.Orange }); // Save the document in HTML format. string outFile = @"ContentRange.html"; dc.Save(outFile, new HtmlFixedSaveOptions() { Title = "ContentRange" }); // Open the result for demonstration purposes. System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(outFile) { UseShellExecute = true }); } } }
Imports SautinSoft.Document Namespace Example Friend Class Program Shared Sub Main(ByVal args() As String) ' You can create the same document by using 3 ways: ' ' + DocumentBuilder ' + DOM directly ' + DOM and ContentRange ' ' Choose any of them which you like. ' Way 1: CreateUsingDocumentBuilder() ' Way 2: CreateUsingDOM() ' Way 3: CreateUsingContentRange() End Sub ''' <summary> ''' Creates a new document using DocumentBuilder and saves it in a desired format. ''' </summary> ''' <remarks> ''' Details: https://www.sautinsoft.com/products/document/help/net/developer-guide/create-document.php ''' </remarks> Private Shared Sub CreateUsingDocumentBuilder() ' Create a new document and DocumentBuilder. Dim dc As New DocumentCore() Dim db As New DocumentBuilder(dc) ' Specify the formatting and insert text. db.CharacterFormat.FontName = "Verdana" db.CharacterFormat.Size = 65.5F db.CharacterFormat.FontColor = Color.Orange db.Write("Hello World!") ' Save the document in DOCX format. Dim outFile As String = "DocumentBuilder.docx" dc.Save(outFile) ' Open the result for demonstration purposes. System.Diagnostics.Process.Start(New System.Diagnostics.ProcessStartInfo(outFile) With {.UseShellExecute = True}) End Sub ''' <summary> ''' Creates a new document using DOM and saves it in a desired format. ''' </summary> ''' <remarks> ''' Details: https://www.sautinsoft.com/products/document/help/net/developer-guide/create-document.php ''' </remarks> Private Shared Sub CreateUsingDOM() ' Create a new document. Dim dc As New DocumentCore() ' Create a new section, ' add the section the document. Dim sect As New Section(dc) dc.Sections.Add(sect) ' Create a new paragraph, ' add the paragraph to the section. Dim par As New Paragraph(dc) sect.Blocks.Add(par) ' Create a new run (text object), ' add the run to the paragraph. Dim run As New Run(dc, "Hello World!") run.CharacterFormat.FontName = "Verdana" run.CharacterFormat.Size = 65.5F run.CharacterFormat.FontColor = Color.Orange par.Inlines.Add(run) ' Save the document in PDF format. Dim outFile As String = "DOM.pdf" dc.Save(outFile) ' Open the result for demonstration purposes. System.Diagnostics.Process.Start(New System.Diagnostics.ProcessStartInfo(outFile) With {.UseShellExecute = True}) End Sub ''' <summary> ''' Creates a new document using DOM and ContentRange and saves it in a desired format. ''' </summary> ''' <remarks> ''' Details: https://www.sautinsoft.com/products/document/help/net/developer-guide/create-document.php ''' </remarks> Private Shared Sub CreateUsingContentRange() ' Create a new document. Dim dc As New DocumentCore() ' Insert the formatted text into the document. dc.Content.End.Insert("Hello World!", New CharacterFormat() With { .FontName = "Verdana", .Size = 65.5F, .FontColor = Color.Orange }) ' Save the document in HTML format. Dim outFile As String = "ContentRange.html" dc.Save(outFile, New HtmlFixedSaveOptions() With {.Title = "ContentRange"}) ' Open the result for demonstration purposes. System.Diagnostics.Process.Start(New System.Diagnostics.ProcessStartInfo(outFile) With {.UseShellExecute = True}) End Sub End Class End Namespace