Spire.Office 9.4.0 is released

2024-04-28 07:21:21

We are delighted to announce the release of Spire.Office 9.4.0. In this version, Spire.Doc supports working with Markdown documents; Spire.PDF supports getting the font and font size of the found text and retrieving the font formatting of found text; Spire.Presentation supports inserting math equations in paragraphs and embedding SVG files into slides as images. Moreover, a lot of known issues are fixed successfully in this version. More details are listed 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, and Spire.Barcode are included.

DLL Versions:

  • Spire.Doc.dll v12.4.7.0
  • Spire.Pdf.dll v10.4.7.0
  • Spire.XLS.dll v14.4.7.0
  • Spire.Presentation.dll v9.4.5.0
  • Spire.Barcode.dll v7.2.9.0
  • Spire.Email.dll v6.5.10.0
  • Spire.DocViewer.Forms.dll v8.7.8.0
  • Spire.PdfViewer.Asp.dll v7.12.14.0
  • Spire.PdfViewer.Forms.dll v7.12.14.0
  • Spire.Spreadsheet.dll v7.4.6.0
  • Spire.OfficeViewer.Forms.dll v8.7.10.0
  • Spire.DataExport.dll v4.9.0.0
  • Spire.DataExport.ResourceMgr.dll v2.1.0
Click the link to get the version Spire.Office 9.4.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
New feature SPIREDOC-10091
SPIREDOC-10217
Supports loading and manipulating Markdown documents or converting Word documents to Markdown.
Document doc = new Document();
//load .md file
doc.LoadFromFile("input.md");
//save to .md file
//doc.SaveToFile("output.md", Spire.Doc.FileFormat.Markdown);
//save to .docx file
//doc.SaveToFile("output.docx", Spire.Doc.FileFormat.Docx);
//save to .doc file
//doc.SaveToFile("output.doc", Spire.Doc.FileFormat.Doc);
//save to .pdf file
doc.SaveToFile("output.pdf", Spire.Doc.FileFormat.PDF);
doc.Close();

Document doc = new Document();
//load .docx file
doc.LoadFromFile("input.docx");
//load .doc file
//doc.LoadFromFile("input.doc");
//save to .md file
doc.SaveToFile("output.md", Spire.Doc.FileFormat.Markdown);
doc.Close();
Bug SPIREDOC-10307 Fixes the issue that setting Header.LinkToPrevious and Footer.LinkToPrevious did not take effect.
Bug SPIREDOC-10316 Fixes the issue that some contents were lost after converting Word to PDF.
Bug SPIREDOC-10328 Fixes the issue that the bookmarks were incorrect after converting Word to PDF.
Bug SPIREDOC-10370 Fixes the issue that ReplaceInLine method throws "System.NullReferenceException".

Spire.PDF

Category ID Description
New feature SPIREPDF-2422
SPIREPDF-6640
Supports retrieving the font formatting of found text.
Note: Only supports retrieving bold, faux bold (font style set to fill and stroke), italic, and color; does not support retrieving underline.
PdfDocument pdf = new PdfDocument();
pdf.LoadFromFile(inputFile);
PdfPageBase page = pdf.Pages[0];
PdfTextFinder finds = new PdfTextFinder(page);
finds.Options.Parameter = TextFindParameter.None;
List<PdfTextFragment> result = finds.Find("hello");
StringBuilder str = new StringBuilder();
foreach (PdfTextFragment find in result)
{
	string text = find.LineText;
	string FontName = find.TextStates[0].FontName;
	float FontSize = find.TextStates[0].FontSize;
	string FontFamily = find.TextStates[0].FontFamily;
	bool IsBold = find.TextStates[0].IsBold;
	bool IsSimulateBold = find.TextStates[0].IsSimulateBold;
	bool IsItalic = find.TextStates[0].IsItalic;
	Color color = find.TextStates[0].ForegroundColor;
	str.AppendLine(text);
	str.AppendLine("FontName: " + FontName);
	str.AppendLine("FontSize: " + FontSize);
	str.AppendLine("FontFamily: " + FontFamily);
	str.AppendLine("IsBold: " + IsBold);
	str.AppendLine("IsSimulateBold: " + IsSimulateBold);
	str.AppendLine("IsItalic: " + IsItalic);
	str.AppendLine("color: " + color);
	str.AppendLine(" ");
}
PdfTextReplacer ptr = new PdfTextReplacer(page);
ptr.ReplaceAllText("hello", "New");
File.WriteAllText(outputFile_T, str.ToString());
pdf.SaveToFile(outputFile);
pdf.Dispose();
New feature SPIREPDF-6602 Adds a progress callback interface for saving documents.
PdfDocument pdf = new PdfDocument();
pdf.LoadFromFile(inputFile);
pdf.RegisterProgressNotifier(new CustomProgressNotifier());
pdf.SaveToFile(outputFile, FileFormat.XPS);
pdf.Close();

public class CustomProgressNotifier :IProgressNotifier
{
	StringBuilder str = new StringBuilder();
	public void Notify(float progress)
	{
		str.AppendLine(progress + "%");
		File.WriteAllText(outputFile_txt, str.ToString());
	}
}
New feature SPIREPDF-5779 Supports getting the font and font size of the found text.
PdfDocument pdf = new PdfDocument();
pdf.LoadFromFile("test.pdf");
PdfTextFindOptions findOptions = new PdfTextFindOptions();
findOptions.Parameter = TextFindParameter.IgnoreCase;
foreach (PdfPageBase page in pdf.Pages)
{
  PdfTextFinder finder = new PdfTextFinder(page);
  finder.Options = findOptions;
  List results = finder.Find("total");
  foreach (PdfTextFragment text in results)
  {
	  String font=text.TextStates[0].FontName;
	  float size = text.TextStates[0].FontSize;
	  String fontF = text.TextStates[0].FontFamily;
  }
}
Bug SPIREPDF-2912 Optimizes the time consumption for building PDFs with a large number of pages.
Bug SPIREPDF-6370 Optimizes the effect of the PdfDestination method.
Bug SPIREPDF-6537 Fixes the issue that the content was lost after setting the PDF form field to Flatten.
Bug SPIREPDF-6541 Optimizes the time consumption for compressing PDFs.
Bug SPIREPDF-6553 Fixes the issue that the search highlighting didn't take effect.
Bug SPIREPDF-6559
SPIREPDF-6579
Fixes the issue that the application threw an "OutOfMemoryException" when converting to grayscale PDF.
Bug SPIREPDF-6580 Fixes the issue that some characters were displayed incorrectly when converting XPS to PDF.
Bug SPIREPDF-6582 Fixes the issue that the application threw the "FormatException" when converting OFD to PDF.
Bug SPIREPDF-6583 Fixes the issue that the images were missing when converting XPS to PDF.
Bug SPIREPDF-6600 Optimizes the effect of compressing PDFs.
Bug SPIREPDF-6607 Fixes the issue that the application threw an "ArgumentOutOfRangeException" when converting PDF to images.
Bug SPIREPDF-6626 Fixes the issue that the content was lost when converting PDF documents to images.
Bug SPIREPDF-6627 Fixes the issue that it failed to draw text containing the "∙" (unicode = 8729) character on a PDF page.
Bug SPIREPDF-6634 Fixes the issue that the application threw "System.NullReferenceException" when printing grayscale PDF documents.
Bug SPIREPDF-6635 Fixes the issue that the application threw "System.ArgumentNullException" when converting grayscale PDF documents.
Bug SPIREPDF-6636 Fixes the issue that the verification results were incorrect when using signatureOne.VerifySignature() method to verify digital signatures.
Bug SPIREPDF-6639 Fixes the issue that the images were lost when converting XPS documents to PDF documents.
Bug SPIREPDF-6641
SPIREPDF-6645
Fixes the issue that the application threw "System.NullReferenceException" when converting OFD documents to PDF documents.
Bug SPIREPDF-6656 Fixes the issue that the signatures were invalid after loading and saving PDF documents.
Bug SPIREPDF-6660 Fixes the issue that the application threw "System.ArgumentException" when converting OFD documents to PDF documents.
Bug SPIREPDF-6673 Fixes the issue that the application threw "System.ArgumentNullException" during finding text.
Bug SPIREPDF-3181 Fixes the issue that text in vertically aligned format could not be highlighted.
Bug SPIREPDF-6598 Fixes the issue that the program did not report an error when using the PdfDocument.LoadFromFile(string filename) method to load a document with a password.
Bug SPIREPDF-6611 Fixes the issue that a dialog box prompting font problems popped up when using Adobe tools to open PDF documents converted from XPS documents.
Bug SPIREPDF-6622 Fixes the issue that invisible transparent text was displayed after converting a PDF document to an OFD document.
Bug SPIREPDF-6623 Fixes the issue that the program threw an exception System.ArgumentException when converting an OFD document to a PDF document.

Spire.Presentation

Category ID Description
New feature SPIREPPT-2469 Supports adding placeholders.
public enum InsertPlaceholderType
{
   Content = 0,
   VerticalContent = 1,
   Text = 2,
   VerticalText = 3,
   Picture = 4,
   Chart = 5,
   Table = 6,
   SmartArt = 7,
   Media = 8,
   OnlineImage = 9
}

presentation.Masters[0].Layouts[0].InsertPlaceholder(InsertPlaceholderType.Text, new RectangleF(20, 30, 400, 400));
New feature SPIREPPT-2476 Supports setting map projection for map charts.
Presentation ppt = new Presentation();
ppt.LoadFromFile(inputFile);
IChart chart = ppt.Slides[0].Shapes[9] as IChart;
ProjectionType type = chart.Series[0].ProjectionType;
chart.Series[0].ProjectionType = ProjectionType.Robinson;
ppt.SaveToFile(outputFile, FileFormat.Pptx2013);
ppt.Dispose();
New feature SPIREPPT-2479 Supports inserting math equations in paragraphs.
Presentation ppt = new Presentation();
string latexMathCode = "x^{2}+\\sqrt{x^{2}+1=2}";
IAutoShape shape = ppt.Slides[0].Shapes.AppendShape(ShapeType.Rectangle, new RectangleF(30, 100, 400, 200));
shape.TextFrame.Paragraphs.Clear();
TextParagraph p = new TextParagraph();
p.ParagraphProperties.DefaultTextRangeProperties.Fill.FillType = FillFormatType.Solid;
p.ParagraphProperties.DefaultTextRangeProperties.Fill.SolidColor.Color = Color.Black;
shape.TextFrame.Paragraphs.Append(p);
TextRange portionEx = new TextRange("Hello World");
p.TextRanges.Append(portionEx);
p.AppendFromLatexMathCode(latexMathCode);
TextRange portionEx2 = new TextRange("My name is Tom.");
p.TextRanges.Append(portionEx2);
ppt.SaveToFile(outputFile, FileFormat.Auto);
ppt.Dispose();
New feature SPIREPPT-2484 Supports embedding SVG files as images in slides. (This feature is supported in PPTX 2016 and later versions, not for PPT format files.)
presentation.Slides[0].Shapes.AddFromSVG(inputFile, new RectangleF(40, 40, 200, 200));
Bug SPIREPPT-2482 Fixes the issue that the direction of gradient color backgrounds was rotated when converting PPTX documents to SVG documents.

Spire.XLS

Category ID Description
Bug SPIREXLS-5107 Fixed the issue that the pivot table data was incorrect after converting an Excel document to a picture.
Bug SPIREXLS-5137 Fixed the issue that the program threw a System.NullReferenceException when converting an Excel document to a PDF document.
Bug SPIREXLS-5175 Fixed the issue that the program threw a System.NullPointerException when loading Excel documents.
Bug SPIREXLS-5176 Fixes the issue where the program threw System.NullReferenceException when loading an Excel document.
Bug SPIREXLS-5193 Fixes the issue that it failed to open an XLTM document with the MS Excel tool after reading it with Spire.Xls and saving it to a new XLTM document.
Bug SPIREXLS-5199 Fixed the issue that formulas were not calculated after inserting data containing formulas using the Worksheet.InsertDataTable() method.