You can easily use «Document .Net» in .NET Core 2.0, 2.1 or higher. It's completely written in C# managed code and compiled under .NET Framework and .NET Core.
Let us say, you have just created a .NET Core project. To configure Document .Net in your project, make these steps:
If you have added the SautinSoft.Document.dll into your project in previous step 1 through Nuget, all dependencies are already installed automatically and therefore simply skip this step.
In case of you have added the reference to the SautinSoft.Document.dll by the old way (Solution Explorer->right click by "References"->Add Reference...), please add these dependencies using Nuget:
For example, to add "System.IO.Packaging, 4.4.0:
You may add the reference to the SautinSoft.Document assembly by two ways:
1. Nuget (fast way):
2. Old good way by adding the reference:
Note:
SautinSoft.Document.dll compiled for .NET Core is located inside (document_net.zip->Document .Net X.X\Bin\.NET Core X.X) folder.
SautinSoft.Document.dll compiled for .NET Framework is located inside (document_net.zip->Document .Net X.X\Bin\.NET Framework X.X) folder.
Complete code
using SautinSoft.Document;
namespace Sample
{
class Sample
{
static void Main(string[] args)
{
ExampleHelloWorld();
}
/// <summary>
/// Create file with Hello World.
/// </summary>
/// <remarks>
/// Details: https://sautinsoft.com/products/document/help/net/developer-guide/using-in-netcore.php
/// </remarks>
static void ExampleHelloWorld()
{
DocumentCore dc = new DocumentCore();
dc.Content.End.Insert("Hello World!", new CharacterFormat() { FontName = "Verdana", Size = 65.5d,FontColor = Color.DarkBlue });
// Save a document to a file in DOCX format.
string filePath = @"Result.docx";
dc.Save(filePath);
// Open the result for demonstration purposes.
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(filePath) { UseShellExecute = true });
}
}
}
Imports System
Imports System.IO
Imports SautinSoft.Document
Module Sample
Sub Main()
ExampleHelloWorld()
End Sub
''' <summary>
''' Create file with Hello World.
''' </summary>
''' <remarks>
''' Details: https://sautinsoft.com/products/document/help/net/developer-guide/using-in-netcore.php
''' </remarks>
Sub ExampleHelloWorld()
Dim dc As New DocumentCore()
dc.Content.End.Insert("Hello World!", New CharacterFormat() With {
.FontName = "Verdana",
.Size = 65.5R,
.FontColor = Color.DarkBlue
})
' Save a document to a file in DOCX format.
Dim filePath As String = "Result.docx"
dc.Save(filePath)
' Open the result for demonstration purposes.
System.Diagnostics.Process.Start(New System.Diagnostics.ProcessStartInfo(filePath) With {.UseShellExecute = True})
End Sub
End Module
If you need a new code example or have a question: email us at support@sautinsoft.com or ask at Online Chat (right-bottom corner of this page) or use the Form below: