We’re pleased to announce the release of Spire.Doc for .NET 14.1.12. This update introduces several valuable new features, including the ability to delete specified or blank pages in Word documents, create and manipulate VBA macros, and retrieve complete revision information from documents. In addition, multiple known issues have been resolved to improve overall stability and performance. More details are listed below.
Here is a list of changes made in this release
| Category | ID | Description |
| New feature | SPIREDOC-3929 | Added support for configuring formula conversion to MathML when converting Word to HTML.
HtmlExportOptions options = doc.HtmlExportOptions; options.OfficeMathOutputMode = HtmlOfficeMathOutputMode.MathML; |
| New feature | SPIREDOC-9868 | Added support for deleting specified pages and blank pages.
doc.RemoveBlankPages(); // Delete blank pages
doc.RemovePages(new List {0,1,3}); // Delete specified pages
|
| New feature | SPIREDOC-11489 | Added support for creating and manipulating VBA macros.
Document doc = new Document();
doc.AddSection().AddParagraph().AppendText("wertyuiop[]fghjk");
// Add VBA project to document
VbaProject vbaProject = new VbaProject();
vbaProject.Name = "SampleVBAMacro";
doc.VbaProject = vbaProject;
// Add modules to VBA project
// Module 1
VbaModule vbaModule1 = doc.VbaProject.Modules.Add("SampleModule1", VbaModuleType.StdModule);
vbaModule1.SourceCode = @"
Sub DocumnetInfo()
MsgBox ""create time: "" &Now()
MsgBox ""Pages:"" & ActiveDocument.Range.ComputeStatistics(wdStatisticPages)
End Sub
Sub WriteHello()
Selection.TypeText Text:=""Hello World!""
End Sub";
// Module 2
VbaModule vbaModule2 = doc.VbaProject.Modules.Add("SampleModule2", VbaModuleType.StdModule);
vbaModule2.SourceCode = @"
Sub InsertCurrentDate()
Selection.TypeText Text:=Format(Now(),""yyyy-mm-dd hh:mm:ss"")
End Sub
Sub IndentParagraph()
Selection.ParagraphFormat.LeftIndent = InchesToPoints(0.5)
End Sub";
doc.SaveToFile("result.docm", FileFormat.Docm);
doc.Close();
|
| New feature | SPIREDOC-11598 | Added GetRevisionInfos() method to retrieve full revision information from the document.
Document doc = new Document();
doc.LoadFromFile("input.docx");
StringBuilder sb = new StringBuilder();
RevisionInfoCollection revisionInfoCollection = doc.GetRevisionInfos();
foreach (RevisionInfo revisionInfo in revisionInfoCollection)
{
sb.AppendLine("[author]:" + revisionInfo.Author + "\r\n" + " [RevisionType]:" + revisionInfo.RevisionType + "\r\n" + " [DateTime]:" + revisionInfo.DateTime.ToString() + "\r\n" + " [OwnerObject]:" + revisionInfo.OwnerObject + "\r\n" + " [OwnerObject.Owner]:" + revisionInfo.OwnerObject.Owner + "\r\n");
if (revisionInfo.OwnerObject is TextRange textRange)
{
TextRange range = (TextRange)textRange;
sb.AppendLine($"TextRange - Content:{range.Text}");
}
}
File.WriteAllText(outputFile, sb.ToString());
doc.Dispose();
|
| Bug | SPIREDOC-11523 | Fixed the issue where the program hangs when converting Word to PDF. |
| Bug | SPIREDOC-11632 | Fixed the issue where line breaks are incorrect when adding multi-line watermarks. |
| Bug | SPIREDOC-11692 | Fixed the issue where table of contents fields fail to update. |
| Bug | SPIREDOC-11703 | Fixed the issue where the result is incorrect when converting Markdown to Word. |
| Bug | SPIREDOC-11706 | Fixed the issue where document saving takes a long time when adding multi-line text with "\r\n". |
| Bug | SPIREDOC-11727 | Fixed the issue where extra blank paragraphs appear when adding HTML to Word. |
| Bug | SPIREDOC-11744 | Fixed the issue where images are blurry when converting Word to HTML. |
| Bug | SPIREDOC-11767 | Fixed the issue where content is inconsistent when loading and saving RTF files. |
Click the link below to download Spire.Doc 14.1.12:
More information of Spire.Doc new release or hotfix: