Spire.Office for .NET is a combination of Enterprise-Level Office .NET API offered by E-iceblue. It includes Spire.Doc, Spire.XLS, Spire.Spreadsheet, Spire.Presentation, Spire.PDF, Spire.DataExport, Spire.OfficeViewer, Spire.PDFViewer, Spire.DocViewer, Spire.Barcode and Spire.Email. Spire.Office contains the most up-to-date versions of the above .NET API.

With Spire.Office for .NET, developers can create a wide range of applications. It enables developers to open, create, modify, convert, print, View MS Word, Excel, PowerPoint and PDF documents. Furthermore, it allows users to export data to popular files such as MS Word/Excel/RTF/Access, PowerPoint, PDF, XPS, HTML, XML, Text, CSV, DBF, Clipboard, SYLK, PostScript, PCL, etc.

Spire.Office for .NET can be linked into any type of a 32-bit or 64-bit .NET application including ASP.NET, Web Services and WinForms for .NET Framework version 2.0 to 4.5. Spire.Office also supports to work on .NET Core, .NET 5.0, .NET 6.0, .NET 8.0,.NET 9.0, .NET 10.0, Microsoft Azure, Mono Android and Xamarin.iOS.

Here is a list of changes made in this release

Spre.doc

CategoryIDDescription
New featureSPIREDOC-3929Added support for configuring formula conversion to MathML when converting Word to HTML.
HtmlExportOptions options = doc.HtmlExportOptions;
options.OfficeMathOutputMode = HtmlOfficeMathOutputMode.MathML;
New featureSPIREDOC-9868Added support for deleting specified pages and blank pages.
doc.RemoveBlankPages(); // Delete blank pages
doc.RemovePages(new List {0,1,3}); // Delete specified pages
New featureSPIREDOC-11489Added 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 featureSPIREDOC-11598Added 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();
BugSPIREDOC-11523Fixed the issue where the program hangs when converting Word to PDF.
BugSPIREDOC-11632Fixed the issue where line breaks are incorrect when adding multi-line watermarks.
BugSPIREDOC-11692Fixed the issue where table of contents fields fail to update.
BugSPIREDOC-11703Fixed the issue where the result is incorrect when converting Markdown to Word.
BugSPIREDOC-11706Fixed the issue where document saving takes a long time when adding multi-line text with "\r\n".
BugSPIREDOC-11727Fixed the issue where extra blank paragraphs appear when adding HTML to Word.
BugSPIREDOC-11744Fixed the issue where images are blurry when converting Word to HTML.
BugSPIREDOC-11767Fixed the issue where content is inconsistent when loading and saving RTF files.
BugSPIREDOC-10843Fixed the issue where the program hung for a long time when using new FixedLayoutDocument(document).
BugSPIREDOC-11532Fixed the issue where the program hung for a long time when converting Word documents to PDF.
BugSPIREDOC-11758Fixed the issue where an incorrect numbering format was returned when retrieving lists.
BugSPIREDOC-11728 SPIREDOC-11730 SPIREDOC-11731Fixed the issue where incorrect content was generated when converting Word documents to PDF.

Spre.XLS

CategoryIDDescription
New featureSPIREXLS-5948Added support for the BYROW and BYCOL functions.
// Use BYROW to calculate the average of each row
sheet.Range["G2"].Formula = "=BYROW(B2:F2, LAMBDA(row, AVERAGE(row)))";
// Use BYCOL to calculate the average of each column
sheet.Range["B8"].Formula = "=BYCOL(B2:B7, LAMBDA(col, AVERAGE(col)))";
New featureSPIREXLS-5980Added support for converting a specified cell range to HTML.
Workbook workbook = new Workbook();
workbook.LoadFromFile(inputFile);
Worksheet sheet = workbook.Worksheets[0];
CellRange cell = sheet.Range["A1:B3"];
string html = cell.HtmlString;
File.WriteAllText(outputFile, html);
New featureSPIREXLS-5983Added support for transposing rows and columns when copying a cell range.
CopyRangeOptions options = CopyRangeOptions.Transpose | CopyRangeOptions.All;
sheet["A1:C4"].Copy(sheet["D2:G3"], options);
sheet["A1:B5"].Copy(sheet["D5"], options);
workbook.SaveToFile(outputFile);
New featureSPIREXLS-6018Added support for converting Excel files to PDF/UA-compliant documents.
Workbook workbook = new Workbook();
workbook.LoadFromFile(inputFile);
workbook.ConverterSetting.PdfConformanceLevel = Spire.Xls.Pdf.PdfConformanceLevel.Pdf_UA1;
workbook.SaveToFile(outputFile, FileFormat.PDF);
workbook.Dispose();
BugSPIREXLS-6044Fixed an issue where OLE objects in the document could not be deleted successfully.

Spire.Presentation

CategoryIDDescription
New feature-Added support for highlighting text based on regular expression matches.
// Simple word matching
Regex regex = new Regex(@"\bhello\b");
IAutoShape shape = (IAutoShape)ppt.Slides[0].Shapes[0];
TextHighLightingOptions options = new TextHighLightingOptions();
shape.TextFrame.HighLightRegex(regex, Color.Red, options);
New featureSPIREPPT-3051Fixed the issue where some content was lost during PPTX-to-PDF conversion.
BugSPIREPPT-3058Fixed the issue where the configured default font was not applied during PPTX-to-PDF conversion.

Spire.PDF

CategoryIDDescription
New featureSPIREPDF-5365Supports getting and setting the PDF 2.0 version.
// Retrieve
PdfFileInfo info = doc.FileInfo;
PdfVersion version = info.Version;

// Settings
doc.FileInfo.Version = PdfVersion.Version2_0;
BugSPIREPDF-6905Fixes the issue where text color was rendered incorrectly when converting PDF to images.
BugSPIREPDF-7866Fixes the issue where memory was not properly released during text replacement.
BugSPIREPDF-7875Fixes the issue where QR codes were missing after converting PDF to PDF/A or images.
BugSPIREPDF-7884Fixes the issue where an ArgumentOutOfRangeException was thrown when loading XPS files.
BugSPIREPDF-7892Fixes the issue where text extraction failed under certain conditions.
BugSPIREPDF-7867Fixes the issue where rendering effects were incorrect when converting PDF to Word.
BugSPIREPDF-7097Fixes the issue where content copied from the result document was incorrect after converting PDF to PDF/A-3B.
BugSPIREPDF-7841Fixes the page numbering style issue when using ChromeHtmlConverter to convert HTML to PDF for printing.
BugSPIREPDF-7847Fixes the issue where obtaining font properties of text box fields threw an "ArgumentOutOfRangeException".
BugSPIREPDF-7888Optimizes timestamp requests by reducing calls to timestamp servers and improving validation.
Logo

助力广东及东莞地区开发者,代码托管、在线学习与竞赛、技术交流与分享、资源共享、职业发展,成为松山湖开发者首选的工作与学习平台

更多推荐