Document .Net supports these formats:
DOCX | RTF | HTML | |
---|---|---|---|
Create/Read/Write | Create/Read/Write | Create/Read/Write | Create/Read/Write |
Let's create a simple document with "Hello World!" text:
using SautinSoft.Document;
DocumentCore dc = new DocumentCore();
DocumentCore is root class, it represents a document itself.
dc.Content.End.Insert("Hello World!");
ContentRange represents an area in document as a contiguous sequence of characters boundend by start and end positions.
It allows to insert and extract data in a streaming manner in(from) desired positions.using SautinSoft.Document;
namespace Example
{
class Program
{
static void Main(string[] args)
{
CreateDocument();
}
/// <summary>
/// Creates a new document and saves it in a desired format.
/// </summary>
/// <remarks>
/// Details: https://www.sautinsoft.com/products/document/examples/create-document.php
/// </remarks>
static void CreateDocument()
{
DocumentCore dc = new DocumentCore();
dc.Content.End.Insert("Hello World!", new CharacterFormat() { FontName = "Verdana", Size = 65.5f, FontColor = Color.Orange });
// Save a document to a file in DOCX format.
string filePath = @"Result.docx";
dc.Save(filePath);
// Open the result for demonstation purposes.
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(filePath) { UseShellExecute = true });
}
}
}
Imports SautinSoft.Document
Module Sample
Sub Main()
CreateDocument()
End Sub
''' <summary>
''' Creates a new document and saves it in a desired format.
''' </summary>
''' <remarks>
''' Details: https://www.sautinsoft.com/products/document/examples/create-document.php
''' </remarks>
Sub CreateDocument()
Dim dc As New DocumentCore()
dc.Content.End.Insert("Hello World!", New CharacterFormat() With {
.FontName = "Verdana",
.Size = 65.5F,
.FontColor = Color.Orange
})
' Save a document to a file in DOCX format.
Dim filePath As String = "Result.docx"
dc.Save(filePath)
' Open the result for demonstation purposes.
System.Diagnostics.Process.Start(New System.Diagnostics.ProcessStartInfo(filePath) With {.UseShellExecute = True})
End Sub
End Module