We’re pleased to announce the release of Spire.Doc 14.9.11. This release introduces the ImportOptions and ExportOptions classes for granular control over document loading and export workflows, adds support for HSL color rendering in HTML-to-Word conversion, and resolves numerous known defects encountered during format conversion and general document manipulation. More details are given below.
Here is a list of changes made in this release
| Category | ID | Description |
| Adjustment | - | Implemented internal Word-like language options. Languages adapt to thread culture by default: the "ChinaPRC" culture loads Chinese, and all others fall back to English. This setting alters how generated documents render. |
| Adjustment | - | Revised the .NET Core packaging approach. Cross-platform compatibility is realized by adhering to the .NET Standard specification. Dependencies in readme.txt were updated for .NET 6.0, .NET 9.0 and .NET 10.0 as listed below; all other platforms remain unchanged:
net6.0 Has external reference to SkiaSharp >= 3.116.1 Microsoft.Win32.Registry >= 5.0.0 System.Buffers >= 4.5.1 System.Memory >= 4.5.5 System.Text.Encoding.CodePages >= 6.0.0 HarfBuzzSharp >=8.3.0.1 net9.0 Has external reference to SkiaSharp >= 3.116.1 Microsoft.Win32.Registry >= 5.0.0 System.Buffers >= 4.5.1 System.Memory >= 4.5.5 System.Text.Encoding.CodePages >= 9.0.0 HarfBuzzSharp >=8.3.0.1 net10.0 Has external reference to SkiaSharp >= 3.116.1 Microsoft.Win32.Registry >= 5.0.0 System.Buffers >= 4.5.1 System.Memory >= 4.5.5 System.Text.Encoding.CodePages >= 10.0.0 HarfBuzzSharp >=8.3.0.1 |
| Adjustment | - | Removed all AI-related functionalities. |
| New Feature | - | Provided the ImportOptions and ExportOptions option classes to control the behavior of document loading and exporting. 1. Load an encrypted document with a password using Spire.Doc;
using Spire.Doc.Importing;
var importOptions = new ImportOptions { Password = "123456" };
var doc = new Document();
doc.LoadFromFile("encrypted.docx", importOptions);
using Spire.Doc;
using Spire.Doc.Importing;
// Implement the asset loading callback
public class MyAssetLoader : IAssetLoadingCallback
{
public AssetLoadingAction AssetLoading(AssetLoadingArgs args)
{
// Block tracking images
if (args.Url.Contains("tracker"))
return AssetLoadingAction.Block;
// Provide custom image data with authentication
if (args.AssetType == AssetType.Image && args.Url.StartsWith("https://api."))
{
var data = LoadWithAuth(args.Url);
args.SetData(data);
return AssetLoadingAction.Custom;
}
// Redirect CDN addresses
if (args.Url.Contains("cdn.example.com"))
{
args.Url = args.Url.Replace("cdn.example.com", "local.mirror.com");
return AssetLoadingAction.Download;
}
// Default behavior: download from the original URL
return AssetLoadingAction.Download;
}
}
// Load a document using the callback
var doc = new Document();
var options = new ImportOptions
{
AssetLoadingCallback = new MyAssetLoader()
};
doc.LoadFromFile("document.html", options);
using Spire.Doc;
using Spire.Doc.Exporting;
var doc = new Document();
doc.LoadFromFile("input.docx");
// Use the default DOC format
//var options = new DocExportOptions();
// Use the default DOCX format
var options = new DocxExportOptions();
doc.SaveToFile("output.docx", options);
// Specify Word 2019 format
doc.SaveToFile("output.docx", new DocxExportOptions(FileFormat.Docx2019));
using Spire.Doc;
using Spire.Doc.Exporting;
// 1. Implement the progress callback interface
public class ProgressReporter : IExportingProgressCallback
{
public void OnProgress(ExportingProgressArgs args)
{
// EstimatedProgressPercentage ranges from 0 to 100
Console.WriteLine($"Progress: {args.EstimatedProgressPercentage:F1}%");
// Throw an exception here if you need to abort the saving process
}
}
// 2. Set the callback and export
var doc = new Document();
doc.LoadFromFile("large-document.docx");
var options = new DocxExportOptions(FileFormat.Docx)
{
ProgressCallback = new ProgressReporter()
};
doc.SaveToFile("output.docx", options);
|
| New Feature | SPIREDOC-10309 | Added support for setting "Don't add space between paragraphs of the same style".
Document doc = ConvertUtil.GetNewEngineDocument();
Section section = doc.AddSection();
ParagraphStyle heading1 = (ParagraphStyle)doc.Styles["Heading 1"];
Assert.IsFalse(heading1.ParagraphFormat.NoSpaceBetweenSameStyle);
heading1.ParagraphFormat.NoSpaceBetweenSameStyle = true;
Spire.Doc.Documents.Paragraph sameStyle1 = AddParagraph(section, SameStyleText1, BuiltinStyle.Heading1);
Spire.Doc.Documents.Paragraph sameStyle2 = AddParagraph(section, SameStyleText2, BuiltinStyle.Heading1);
Spire.Doc.Documents.Paragraph otherStyle = AddParagraph(section, OtherStyleText, BuiltinStyle.Heading2);
doc.SaveToFile(outputFile_temp, FileFormat.Docx);
|
| New Feature | SPIREDOC-10841 | Added support for HSL color settings in HTML.
Document doc = new Document();
Section sec = doc.AddSection();
Paragraph para = sec.AddParagraph();
para.AppendHTML("<p style=\"color:hsl(0,75%,60%)\">Hello</p>");
doc.SaveToFile("HtmlTest_hsl.docx");
|
| New Feature | SPIREDOC-11779 | Added support for removing the border of charts.
Document doc = new Document();
doc.LoadFromFile(@"input.docx");
foreach (Paragraph para in doc.Sections[0].Paragraphs)
{
foreach (DocumentObject obj in para.ChildObjects)
{
if (obj is ShapeObject shape && shape.Chart != null)
{
Chart chart = shape.Chart;
// Remove the border of the chart area
chart.Format.Stroke.Fill.FillType = FillType.NoFill;
}
}
}
doc.SaveToFile("NoBorder.docx", FileFormat.Docx);
|
| Bug Fix | SPIREDOC-9875 | Fixed the issue where the content format was messed up when converting Word to PDF. |
| Bug Fix | SPIREDOC-9888 | Fixed issue with incorrect table parsing when converting Word to PDF. |
| Bug Fix | SPIREDOC-9925 | Fixed the issue where the table style was incorrect when converting a document with merged table cells to PDF. |
| Bug Fix | SPIREDOC-9928 | Fixed the issue where the content format changed when converting Word to PDF. |
| Bug Fix | SPIREDOC-10138 | Fixed the issue with incorrect parsing of LaTeX formulas. |
| Bug Fix | SPIREDOC-10312 | Fixed the issue where the content layout changed when converting Word to PDF. |
| Bug Fix | SPIREDOC-10313 | Fixed the issue where an "IndexOutOfRangeException" was thrown when adding SVG to Word. |
| Bug Fix | SPIREDOC-10356 | Fixed the issue where underlines were lost after converting Word to HTML and then back to Word. |
| Bug Fix | SPIREDOC-10483 | Fixed the issue where an error was thrown when loading a document encrypted by WPS. |
| Bug Fix | SPIREDOC-10563 | Fixed the issue where the cross-reference superscript changed when converting Word to PDF. |
| Bug Fix | SPIREDOC-10611 | Fixed the issue where the WordArt effect was lost when copying the content of a Word document. |
| Bug Fix | SPIREDOC-10733 | Fixed the issue where hyperlinks were lost when saving directly to PDF after adding them. |
| Bug Fix | SPIREDOC-10746 | Fixed the issue where a "NullReferenceException" was thrown when saving to PDF after inserting a page break into a table. |
| Bug Fix | SPIREDOC-10774 | Fixed the issue where text was lost when converting to PDF after replacing content with an empty string. /td> |
| Bug Fix | SPIREDOC-11071 | Fixed the issue where the "{aligned}" was not recognized in formulas, causing line breaks to fail. |
| Bug Fix | SPIREDOC-11774 | Fixed the issue where emojis changed from color to black and white when converting Word to PDF. |
| Bug Fix | SPIREDOC-11286 | Fixed the issue where text was formatted in italics after converting formulas in a Word document to MathML. |
| Bug Fix | SPIREDOC-11834 | Fixed the issue where an "ArgumentException" was thrown when converting Word to PDF. |
| Bug Fix | SPIREDOC-12062 | Fixed the issue where the page number position set by the InsertPageNumbers method was incorrect. |
| Bug Fix | SPIREDOC-12066 | Fixed the issue where page numbers were displayed in red in WPS after saving the document. |
| Bug Fix | SPIREDOC-12070 | Fixed the issue where some characters could not be mapped when converting Word to PDF/A-1b. |
| Bug Fix | SPIREDOC-12071 | Fixed the issue where updating the table of contents field failed. |
| Bug Fix | SPIREDOC-12078 | Fixed the issue where an "Object reference not set to an instance of an object" error was thrown when loading a document with FixedLayoutDocument. |
Click the link below to download Spire.Doc 14.9.11:
More information of Spire.Doc new release or hotfix: