DDDN.OdtToHtml
0.2.18.1
See the version list below for details.
dotnet add package DDDN.OdtToHtml --version 0.2.18.1
NuGet\Install-Package DDDN.OdtToHtml -Version 0.2.18.1
<PackageReference Include="DDDN.OdtToHtml" Version="0.2.18.1" />
paket add DDDN.OdtToHtml --version 0.2.18.1
#r "nuget: DDDN.OdtToHtml, 0.2.18.1"
// Install DDDN.OdtToHtml as a Cake Addin
#addin nuget:?package=DDDN.OdtToHtml&version=0.2.18.1
// Install DDDN.OdtToHtml as a Cake Tool
#tool nuget:?package=DDDN.OdtToHtml&version=0.2.18.1
OdtToHtml
OdtToHtml is a .NET Core/Standard library for converting ODT documents (Open Document Text Format) into responsive HTML/CSS.
How to use
Nuget package
Simply add the DDDN.OdtToHtml nuget package reference to your project.
Sample application
Please have a look at the ASP.NET Core 2.0 DDDN.OdtToHtml.Samples sample application.
Sample code
This example of an ASP.NET sample method shows how to call the Convert
method in order to get the HTML/CSS generated from an ODT document.
public IActionResult Convert(string id)
{
// subdirectory name where the ODT document content files like images will be stored
const string contentSubDirname = "content";
OdtConvertedData convertData = null;
// generating path to the ODT document that will be converted
var odtFileInfo = _hostingEnvironment.WebRootFileProvider.GetFileInfo(Path.Combine("odt", id));
// open the ODT file from the file system
using (IOdtFile odtFile = new OdtFile(odtFileInfo.PhysicalPath))
{
var odtCon = new OdtConvert();
// CALL TO THE CONVERT METHOD
convertData = odtCon.Convert(odtFile, new OdtConvertSettings
{
// root HTML tag info that will contains the converted HTML
RootElementTagName = "article",
RootElementId = "artid",
RootElementClassNames = "artclass",
// here you can provide a prefix for all content links to match your environment requirements
LinkUrlPrefix = $"/{contentSubDirname}"
});
}
// move the generated HTML/CSS to the razor web page
ViewData["ArticleHtml"] = convertData.Html;
ViewData["ArticleCss"] = convertData.Css;
// write the content (like images) of the ODT document to the file system to make it available to the web browser
foreach (var articleContent in convertData.EmbedContent)
{
var contentLink = Path.Combine(_hostingEnvironment.WebRootPath, contentSubDirname, articleContent.LinkName);
System.IO.File.WriteAllBytes(contentLink, articleContent.Data);
}
return View();
Development
OdtToHtml has been developed as a part of the CrossBlog ASP.NET Core blog engine. With CrossBlog you can write your blog using the office/word processing application of your choice and of course using the ODT document format. But it can of course also be used otherwise.
Dependencies
There are no package or code dependencies other than the .NETStandard 2.0 libraries.
Missing features
- all canvas/shapes features
- outline functionality (only lists at the moment)
- other features that you don't necessary need for writing blog posts
License
The source code is mainly licensed under GNU General Public License, version 2. Please refer to the source code files for detailed licensing information for each file.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.27.10.301-alpha | 666 | 10/30/2018 |
0.26.2.111-alpha | 821 | 2/11/2018 |
0.26.2.102-alpha | 805 | 2/10/2018 |
0.25.1.211 | 3,761 | 1/21/2018 |
0.2.18.1 | 1,092 | 1/18/2018 |
alpha release