We're pleased to announce the release of Spire.Office 11.9.0. This version adds several new features. For example, Spire.Doc adds new classes to control document loading and exporting; Spire.XLS supports the TRANSPOSS formula. In addition, a series of issues that occurred when processing Word, Excel, PDF, and PowerPoint files have been successfully fixed. More details are given below.
In this version, the most recent versions of Spire.Doc, Spire.PDF, Spire.XLS, Spire.Presentation, Spire.Email, Spire.DocViewer, Spire.PDFViewer, Spire.Spreadsheet, Spire.OfficeViewer, Spire.DataExport, Spire.Barcode are included.
DLL Versions:
- Spire.Doc.dll: 14.9.11
- Spire.XLS.dll: 16.9.2
- Spire.Presentation.dll: 11.9.1
- Spire.Pdf.dll: 12.9.18
- Spire.Barcode.dll: 7.5.13
- Spire.DocViewer.dll: 8.9.5
- Spire.Email.dll: 6.8.0
- Spire.OfficeViewer.dll: 8.8.1
- Spire.PdfViewer.Asp.dll: 8.3.0
- Spire.PdfViewer.Forms.dll: 8.3.0
- Spire.Spreadsheet.dll: 7.5.3
Click the link to get the version Spire.Office 11.9.0:
More information of Spire.Office new release or hotfix:
Here is a list of changes made in this release
Spire.Doc
| Category | ID | Description |
| 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 Original implementation using System.Drawing: Image img = document.SaveToImages(0, ImageType.Bitmap);
img.Save("sample.png", ImageFormat.Png);
SkiaSharp.SKImage images = document.SaveToImages(0, ImageType.Bitmap); FileStream fileStream = new FileStream(outputFile, FileMode.Create, FileAccess.Write); images.Encode(SkiaSharp.SKEncodedImageFormat.Png, 100).SaveTo(fileStream); fileStream.Flush(); |
| New Feature | SPIREDOC-11492 | Added support for creating custom document themes.
// Create a new document and apply the theme
Document doc = new Document();
// Configure a custom theme
Theme theme = doc.Theme;
theme.MajorFonts.Latin = "Courier New"; // Set the heading font to Courier New
theme.MinorFonts.Latin = "Agency FB"; // Set the body font to Agency FB
ThemeColors colors = theme.Colors;
colors.Dark1 = Color.MidnightBlue;
colors.Light1 = Color.PaleGreen;
colors.Dark2 = Color.Indigo;
colors.Light2 = Color.Khaki;
colors.Accent1 = Color.OrangeRed;
colors.Accent2 = Color.LightSalmon;
colors.Accent3 = Color.Yellow;
colors.Accent4 = Color.Gold;
colors.Accent5 = Color.BlueViolet;
colors.Accent6 = Color.DarkViolet;
colors.Hyperlink = Color.Black;
colors.FollowedHyperlink = Color.Gray;
Section section = doc.AddSection();
// Create a heading and apply MajorFonts and the Accent1 color
Paragraph heading = section.AddParagraph();
heading.AppendText("Document Theme Test");
heading.ApplyStyle(BuiltinStyle.Heading1);
// Link the heading style to MajorFonts
ParagraphStyle heading1Style = (ParagraphStyle)doc.Styles["Heading 1"];
heading1Style.CharacterFormat.ThemeFont = ThemeFont.Major; // Use the Major theme font (heading font)
heading1Style.CharacterFormat.ThemeColor = ThemeColor.Accent1; // Use the Accent1 theme color
// Create a body paragraph and apply MinorFonts
Paragraph body = section.AddParagraph();
body.AppendText("This document uses a custom theme created programmatically.");
// Link the Normal style to MinorFonts
ParagraphStyle normalStyle = (ParagraphStyle)doc.Styles["Normal"];
normalStyle.CharacterFormat.ThemeFont = ThemeFont.Minor; // Use the Minor theme font (body font)
normalStyle.CharacterFormat.ThemeColor = ThemeColor.Text1; // Use the default text color
// Add a test paragraph to verify the theme color
Paragraph colorTest = section.AddParagraph();
TextRange textRange = colorTest.AppendText("Accent1 Color Test");
textRange.CharacterFormat.ThemeColor = ThemeColor.Accent1; // Use the Accent1 theme color directly
doc.SaveToFile(outputFile, FileFormat.Docx);
doc.Close();
|
| New Feature | SPIREDOC-11492 | Added support for copying the theme of an existing document to another.
// Load the source document and get its theme
Document sourceDoc = new Document();
sourceDoc.LoadFromFile("Theme.docx");
Theme sourceTheme = sourceDoc.Theme;
// Create a destination document
Document newDoc = new Document();
// Copy the source document's theme (theme fonts and colors) to the destination document
sourceDoc.CloneThemesTo(newDoc);
newDoc.SaveToFile("CopyTheme.docx", FileFormat.Docx);
|
| New Feature | SPIREDOC-11492 | Added support for retrieving and modifying document theme.
Document doc = new Document();
// Set the font faces of the document theme
doc.Theme.MinorFonts.Latin = "Algerian";
doc.Theme.MinorFonts.EastAsian = "Aharoni";
doc.Theme.MinorFonts.ComplexScript = "Andalus";
// Set the theme font and theme color of the style's character format
CharacterFormat font = ((ParagraphStyle)doc.Styles["Normal"]).CharacterFormat;
font.ThemeFont = ThemeFont.Minor;
font.ThemeColor = ThemeColor.Accent2;
// Get the theme font and theme color
ThemeFont themeFont = font.ThemeFont;
string fontName = font.FontName;
Color textColor = font.TextColor;
doc.SaveToFile("ThemeAttributes.docx", FileFormat.Docx);
|
| New Feature | SPIREDOC-11878 | Added support for the "embed only the characters used in the document" setting.
doc.setEmbedFontsInFile(true); doc.setSaveSubsetFonts(true); |
| New Feature | - | Added support for setting the fill format of charts and their data series.
// Create a document and add a column chart
Document doc = new Document();
Section section = doc.AddSection();
ShapeObject shape = section.AddParagraph().AppendChart(ChartType.Column, 500, 300);
Chart chart = shape.Chart;
chart.Series.Clear();
chart.Series.Add("Sales", new string[] { "Q1", "Q2", "Q3", "Q4" }, new double[] { 120, 90, 160, 200 });
// Chart area - solid fill
chart.Format.Fill.FillType = FillType.Solid;
chart.Format.Fill.Color = Color.OrangeRed;
chart.Format.Fill.Transparency = 0.3;
// Data points of the first series - linear gradient fill
Fill seriesFill = chart.Series[0].DataPoints.Format.Fill;
seriesFill.FillType = FillType.Shade;
seriesFill.GradientType = GradientFillType.Linear;
seriesFill.SetGradientDirection(GradientFillDirection.LinearUp);
seriesFill.GradientStops.Add(new GradientStop(0, Color.White));
seriesFill.GradientStops.Add(new GradientStop(1, Color.OrangeRed));
// Data labels - enable and use a solid fill
chart.Series[0].HasDataLabels = true;
chart.Series[0].DataLabels.Format.Fill.FillType = FillType.Solid;
chart.Series[0].DataLabels.Format.Fill.Color = Color.LightYellow;
doc.SaveToFile("ChartFill.docx", FileFormat.Docx);
// Create a document and add a line chart
Document doc = new Document();
Section section = doc.AddSection();
ShapeObject shape = section.AddParagraph().AppendChart(ChartType.Line, 500, 300);
Chart chart = shape.Chart;
chart.Series.Clear();
chart.Series.Add("Trend", new string[] { "Cat1", "Cat2", "Cat3", "Cat4" }, new double[] { 4.3, 2.4, 3.1, 5.2 });
// Chart area - border weight, dash style and solid color
chart.Format.Stroke.Weight = 2;
chart.Format.Stroke.DashStyle = DashStyle.Dash;
chart.Format.Stroke.Fill.FillType = FillType.Solid;
chart.Format.Stroke.Fill.Color = Color.Blue;
// Data series border - set through its data points
chart.Series[0].DataPoints.Format.Stroke.Fill.FillType = FillType.Solid;
chart.Series[0].DataPoints.Format.Stroke.Fill.Color = Color.Red;
chart.Series[0].DataPoints.Format.Stroke.Weight = 1.5;
// Start and end arrows on the axes
chart.AxisX.Format.Stroke.StartArrowType = ArrowType.Arrow;
chart.AxisX.Format.Stroke.EndArrowType = ArrowType.Arrow;
chart.AxisY.Format.Stroke.StartArrowType = ArrowType.Arrow;
chart.AxisY.Format.Stroke.EndArrowType = ArrowType.Arrow;
doc.SaveToFile("ChartStroke.docx", FileFormat.Docx);
|
| 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-12046 | Fixed the issue where extra pages were deleted when deleting pages in Word documents. |
| Bug Fix | SPIREDOC-12058 | Fixed the issue where some Symbol font characters were missing during Word to PDF conversion. |
| 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. |
Spire.XLS
| Category | ID | Description |
| New Feature | SPIREXLS-6200 | Added support for TRANSPOSS formula.
sheet.Range["F1:H4"].FormulaArray = "=TRANSPOSE(A2:D4)"; |
| Bug Fix | SPIREXLS-6204 | Fixed the issue where column widths were inconsistent when converting Excel to PDF. |
| Bug Fix | SPIREXLS-6206 | Fixed the issue where borders appeared thicker when converting Excel to PDF. |
| Bug Fix | SPIREXLS-6209 | Fixed the issue where incorrect data was exported when using ExportDataTable. |
Spire.Presentation
| Category | ID | Description |
| New Feature | SPIREPPT-3172 | Added the Paragraphs.AppendOfficeMathML() method to add Office formulas.
Presentation ppt = new Presentation(); IAutoShape autoShape = ppt.Slides[0].Shapes.AppendShape(ShapeType.Rectangle, new RectangleF(100, 100, 300, 200)); string txtContent = File.ReadAllText(inputFile); autoShape.TextFrame.Paragraphs.AppendOfficeMathML(txtContent); ppt.SaveToFile(outputFile, FileFormat.Pptx2013); ppt.Dispose(); |
| Bug Fix | SPIREPPT-3191 | Fixed an issue where text became blurry and unclear when converting PPT to PDF. |
Spire.PDF
| Category | ID | Description |
| New Feature | SPIREPDF-1 | Added support for creating PDFs by adding content in flowing layout mode. (Note: Creation only; loading or modifying existing documents is not supported.)
// Create a pdf document
PdfDocument pdf = new PdfDocument();
// Create a content builder
PdfContentBuilder builder = new PdfContentBuilder(pdf);
// Add the first section
var s1 = builder.AddSection();
s1.AddHeading1("Section One");
s1.AddParagraph("First flowing paragraph.");
// Add the second section
var s2 = builder.AddSection();
s2.AddHeading1("Section Two");
s2.AddParagraph("Second flowing paragraph.");
// Add the third section (paragraph only)
var s3 = builder.AddSection();
s3.AddParagraph("Third section, only a paragraph.");
// Add the fourth section with headings and navigation entries
var s4 = builder.AddSection();
var h1 = s4.AddHeading(1, "Alpha Chapter");
var h2 = s4.AddHeading(2, "Beta Section");
var h3 = s4.AddHeading(3, "Gamma Subsection");
h1.AsNavigationEntry("Alpha Chapter", 1);
h2.AsNavigationEntry("Beta Section", 2);
h3.AsNavigationEntry("Gamma Subsection", 3);
s4.AddParagraph("Body copy under the headings.");
// Build the document
var result = builder.Build();
// Save the document
String outputFile = "Bug_1_MultipleSections.pdf";
pdf.SaveToFile(outputFile);
pdf.Close();
|
| New Feature | - | Adjusted the method for creating annotation collections from PdfPageBase.AnnotationsV2 to PdfAnnotationCollect.Create (page).
PdfDocument doc = new PdfDocument(); PdfPageBase page = doc.Pages.Add(); RectangleF rect = new RectangleF(140, 689, 80, 1); PdfLineAnnotation lineAnnotation = new PdfLineAnnotation(page, rect, new PointF(140, 690), new PointF(220, 690)); lineAnnotation.Contents = "This is the first line annotation"; // New way PdfAnnotationCollection anmotationCollection = PdfAnnotationCollection.Create(page); anmotationCollection.Add(lineAnnotation); // Old way //page.AnnotationsV2.Add(lineAnnotation); |
| Bug Fix | SPIREPDF-7514 | Fixed the issue where form fields were lost when copying pages using InsertPage. |
| Bug Fix | SPIREPDF-8041 | Fixed the issue where the generated tag structure PDF document could not be fully validated by PDF/UA (ISO 14289-1). |
| Bug Fix | SPIREPDF-8068 | Fixed the failure when importing FDF and adjusted the annotation import API. It is recommended to use PdfAnnotationCollection.Create(document.Pages[0]).ImportFromFdf(). |
| Bug Fix | SPIREPDF-8151 | Fixed the issue where the coordinates and size of the obtained image were incorrect. |
| Bug Fix | SPIREPDF-8152 | Fixed the issue where the field name was duplicated when creating form fields. |
| Bug Fix | SPIREPDF-8101 | Fixed an issue where scaled images were lost when converting XPS to PDF. |
| Optimization | SPIREPDF-8133 | Optimized the conversion time when converting PDF to SVG. |
Spire.Barcode
| Category | ID | Description |
| Bug Fix | SPIREBARCODE-299 | Fixes the issue where barcode data reading was incorrect. |