Spire.Doc 11.8.11 supports converting math formulas to OfficeMathMLCode

2023-08-17 09:49:01

We are happy to announce the release of Spire.Doc 11.8.11. This version supports converting math formulas to OfficeMathMLCode and adding hyperlinks to images in mail merge. It also enhances the conversion from Word to PDF and HTML as well as HTML to Word. Besides, a lot of known issues are fixed in this version, such as the issue that page number fields could not be automatically updated after insertion. More details are listed below.

Here is a list of changes made in this release

Category ID Description
New feature SPIREDOC-9057 Supports converting math formulas to OfficeMathMLCode.
    Document doc = new Document();
            doc.LoadFromFile("1.docx");
            StringBuilder stringBuilder = new StringBuilder();

            foreach (Section section in doc.Sections)
            {
                foreach (Paragraph par in section.Body.Paragraphs)
                {
                    foreach (DocumentObject obj in par.ChildObjects)
                    {
                        OfficeMath omath = obj as OfficeMath;
                        if (omath == null) continue;
                        string mathml = omath.ToOfficeMathMLCode();
                        stringBuilder.Append(mathml);
                        stringBuilder.Append("\r\n");
                    }
                }
            }
            File.WriteAllText("1.txt", stringBuilder.ToString());
            doc.Close();
New feature SPIREDOC-9710 Supports adding hyperlinks to images in mail merge.
Document doc = new Document();
                doc.LoadFromFile("Test.docx");
                var fieldNames = new string[] { "MyImage" };
                var fieldValues = new string[] { "logo.png" };

                doc.MailMerge.MergeImageField += new MergeImageFieldEventHandler(MailMerge_MergeImageField);

                doc.MailMerge.Execute(fieldNames, fieldValues);

                doc.SaveToFile("result.docx", FileFormat.Docx);
            }

            void MailMerge_MergeImageField(object sender, MergeImageFieldEventArgs field)
            {
                string filePath = field.FieldValue as string;
                if (!string.IsNullOrEmpty(filePath))
                {
                    field.Image = Image.FromFile(filePath);
                    field.ImageLink = "https://www.e-iceblue.com/";
                }

            }
Bug SPIREDOC-6013 Fixes the issue that loading Word documents threw a System.InvalidOperationException exception.
Bug SPIREDOC-8541 Fixes the issue that converting Word to PDF caused inconsistent pagination.
Bug SPIREDOC-8587 Fixes the issue that converting Word to PDF threw a System.NullReferenceException exception.
Bug SPIREDOC-9197 Fixes the issue that exporting Docx files from Sparrow and converting them to HTML files failed.
Bug SPIREDOC-9213 Fixes the issue that page number fields could not be automatically updated after insertion.
Bug SPIREDOC-9253 Fixes the issue that list characters were displayed incorrectly when converting HTML to Doc.
Bug SPIREDOC-9310 Fixes the issue that line break tags were ignored when converting HTML to Doc.
Bug SPIREDOC-9400 Fixes the issue that logos were lost when converting Docx to PDF.
Bug SPIREDOC-9627 Fixes the issue that loading RTF documents threw a System.NullReferenceException exception.
Bug SPIREDOC-9640 Fixes the issue that the symbol "~" in LaTeX formulas was parsed incorrectly.
Bug SPIREDOC-9641 Fixes the issue that TOC was split across multiple pages when converting Word to PDF.
Bug SPIREDOC-9684 Fixes the issue that images were blurry when converting Docx to HTML.
Bug SPIREDOC-9712 Fixes the issue that extra text appeared when converting Word to PDF.
Bug SPIREDOC-9755 Fixes the issue that content was inconsistent after loading and saving a document.
Bug SPIREDOC-9761 Fixes the issue that the program hung when inserting HTML strings.
Click the link to download Spire.Doc 11.8.11:
More information of Spire.Doc new release or hotfix: