Spire.Doc 14.1.12 supports creating and manipulating VBA macros in Word
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. |
Spire.PDF for Python 12.1.3 is compatible with Mac M-series chips (ARM64 architecture)
We're pleased to announce the release of Spire.PDF for Python 12.1.3. This version supports customizing signature appearance and retrieving font style information of extracted text. Additionally, several issues that arose during the processing of PDF files have also been resolved. More details are listed below.
Here is a list of changes made in this release
| Category | ID | Description |
| New feature | SPIREPDF-7558 | Completed compatibility support for Mac M-series chips (ARM64 architecture) |
| New feature | SPIREPDF-7000 SPIREPDF-7698 | Added support for customizing signature appearance via the PdfCustomAppearance class.
class MyPdfCustomAppearance(IPdfSignatureAppearance):
def __init__(self):
pass
def Generate(self, g: PdfCanvas):
x = 0.0
y = 0.0
fontSize = 10.0
font = PdfTrueTypeFont("SimSun", fontSize, PdfFontStyle.Regular, True)
lineHeight = fontSize
image = PdfImage.FromFile(inputImage)
g.DrawImage(image, x, y)
x = float(image.Width)
g.DrawString("Signer: Gary", font, PdfBrushes.get_Red(), PointF(x, y))
y += lineHeight + 5
g.DrawString("Phone: +86 12345678", font, PdfBrushes.get_Black(), PointF(x, y))
y += lineHeight + 5
g.DrawString("Address: Sichuan Province, China", font, PdfBrushes.get_Black(), PointF(x, y))
doc = PdfDocument()
doc.LoadFromFile(inputFile)
signatureMaker = PdfOrdinarySignatureMaker(doc, inputFile_pfx, "e-iceblue")
my_appearance = MyPdfCustomAppearance()
customAppearance = PdfCustomAppearance(my_appearance)
signatureMaker.MakeSignature("Signer", doc.Pages.get_Item(0), 90.0, 550.0, 270.0, 640.0, customAppearance)
doc.SaveToFile(outputFile)
|
| New feature | SPIREPDF-7053 | Added support for retrieving font style information of extracted text.
# Load document from disk
doc = PdfDocument()
doc. LoadFromFile(inputFile)
# Define a rectangle
rctg = RectangleF (0.0, 0.0, 200.0, 300.0)
pdfPageBase = doc.Pages.get_Item (0)
finder = PdfTextFinder(pdfPageBase)
finder.Options.Parameter = TextFindParameter.none
finder.Options.Area = rctg
# Find text in the rectangle
findouts = finder.FindAllText()
sb=[]
for fragment in findouts:
sb.append (fragment.Text)
sb.append (fragment.TextStates[0].FontName)
sb.append(str(round(fragment.TextStates[0].FontSize,2)))
result ="result.txt"
|
| Bug | SPIREPDF-6659 | Fixed an issue where text replacement produced incorrect results. |
| Bug | SPIREPDF-7483 | Fixed an issue that the “ffi_prep_cif_var failed” error occurred when running certain Python features on macOS. |
| Bug | SPIREPDF-7819 SPIREPDF-7821 SPIREPDF-7822 | Fixed an issue where content copied from a PDF/A-2B compliant document (converted from PDF) was incorrect. |
| Bug | SPIREPDF-7864 | Fixed an issue where setting a color during text replacement did not take effect as expected. |
Spire.Doc for Java 14.1.3 supports applying custom styles to tables
We're pleased to announce the release of Spire.Doc for Java 14.1.3. This version supports applying custom styles to tables, removing styles via the removeSelf() method, and cloning styles from template documents. Meanwhile, some issues that occurred when converting Word to PDF or Markdown, and updating TOC or page number fields have also been successfully fixed. More details are listed below.
Here is a list of changes made in this release
| Category | ID | Description |
| New feature | SPIREDOC-11582 | Added the removeSelf() method to support removing a style.
document.getStyles().get("style1").removeSelf();
|
| New feature | SPIREDOC-11583 | Supports applying custom styles to tables.
Document doc = new Document();
Section section = doc.addSection();
TableStyle tableStyle = (TableStyle) doc.getStyles().add(StyleType.Table_Style, "TestTableStyle1");
tableStyle.setHorizontalAlignment(RowAlignment.Center);
tableStyle.getBorders().setColor(Color.BLUE);
tableStyle.getBorders().setBorderType(BorderStyle.Single);
Table table = section.addTable();
table.resetCells(1, 1);
table.getRows().get(0).getCells().get(0).addParagraph().appendText("Aligned to the center of the page");
table.setPreferredWidth(PreferredWidth.fromPoints(300));
table.applyStyle(tableStyle);
// table.getFormat().setStyle(tableStyle);
doc.saveToFile(outputDocxFile, FileFormat.Docx);
|
| New feature | SPIREDOC-11748 | Supports cloning styles from a template document.
doc.copyStylesFromTemplate(inputFile_2); // Accepts file path as String doc.copyStylesFromTemplate(doc2); // Accepts another Document object |
| Bug | SPIREDOC-10278 | Fixes the issue where paragraph indentation was incorrect when converting Word to PDF. |
| Bug | SPIREDOC-11142 | Fixes the issue where image layout inside tables was rendered incorrectly during Word-to-PDF conversion. |
| Bug | SPIREDOC-11688 | Fixes the issue where Word-to-PDF conversion did not correctly apply formatting rules specific to WPS Office. |
| Bug | SPIREDOC-11714 | Fixes a NullPointerException that occurred when converting Word to Markdown. |
| Bug | SPIREDOC-11718 | Fixes a NullPointerException that occurred during Word-to-PDF conversion. |
| Bug | SPIREDOC-11734 | Fixes the issue where the application would hang when updating TOC (Table of Contents) fields. |
| Bug | SPIREDOC-11735 | Fixes the issue where page number fields failed to update correctly. |
| Bug | SPIREDOC-11757 | Fixes an IllegalStateException ("Unexpected ST_TrueFalse value") during Word-to-PDF conversion. |
Spire.Presentation for Java 11.1.1 supports reading customer data from shapes
We’re excited to announce the release of Spire.Presentation for Java 11.1.1. This version introduces new features, including reading customer data from shapes and setting audio fade-in and fade-out durations. Additionally, it addresses two known bugs. More details are below.
Here is a list of changes made in this release
| Category | ID | Description |
| New feature | - | Added support for reading customer data from shapes.
Presentation ppt = new Presentation();
ppt.loadFromFile(inputFile);
List dataList = ppt.getSlides().get(0).getShapes().get(0).getCustomerDataList();
System.out.println(dataList.size());
for(int i = 0; i < dataList.size(); i++)
{
String name = dataList.get(i).getName();
String content = dataList.get(i).getXML();
}
|
| New feature | - | Added support for setting audio fade-in and fade-out durations.
Presentation ppt = new Presentation(); ppt.loadFromFile(inputFile); Rectangle2D.Double audioRect = new Rectangle2D.Double(220, 240, 80, 80); IAudio audio=ppt.getSlides().get(0).getShapes().appendAudioMedia(inputFile_1, audioRect); // Set the duration of the starting fade for 13s audio.setFadeInDuration(13000f); // Set the duration of the ending fade for 20s audio.setFadeOutDuration(20000f); ppt.saveToFile(outputFile, FileFormat.PPTX_2016); ppt.dispose(); |
| New feature | - | Added support for trimming audio playback range.
Presentation ppt = new Presentation(); ppt.loadFromFile(inputFile); Rectangle2D.Double audioRect = new Rectangle2D.Double(220, 240, 80, 80); IAudio audio=ppt.getSlides().get(0).getShapes().appendAudioMedia(inputFile_1, audioRect); // Set the start trimming time 8 seconds audio.setTrimFromStart(8000f); // Set the end trimming time 13 seconds audio.setTrimFromEnd(13000f); ppt.saveToFile(outputFile, FileFormat.PPTX_2016); ppt.dispose(); |
| New feature | - | Added support for setting table transparency.
Presentation presentation = new Presentation();
presentation.loadFromFile("data/test.pptx");
Double[] widths = new Double[]{100d, 100d, 150d, 100d, 100d};
Double[] heights = new Double[]{15d, 15d, 15d, 15d, 15d, 15d, 15d, 15d, 15d, 15d, 15d, 15d, 15d};
// Add a table
ITable table = presentation.getSlides().get(0).getShapes().appendTable(
(float) presentation.getSlideSize().getSize().getWidth() / 2 - 275, 90, widths, heights);
// Set overall table background transparency to 50% (0.0 = opaque, 1.0 = fully transparent)
table.getFill().setTransparency(0.5f);
// Customize the fill color of the cell at row 0, column 0 to blue
table.get(0, 0).getFillFormat().setFillType(FillFormatType.SOLID);
table.get(0, 0).getFillFormat().getSolidColor().setColor(Color.BLUE);
presentation.saveToFile("result.pptx", FileFormat.PPTX_2016);
|
| Bug | SPIREPPT-3035 | Fixed the issue where adding a LaTeX formula caused the application to throw a "NullPointerException". |
| Bug | SPIREPPT-3056 | Fixed the issue where a false positive virus alert was triggered by Avira Security Suite for spire.presentation.jar. |
Spire.Doc for Python 14.1.0 adds new interfaces for managing table styles
We're pleased to announce the release of Spire.Doc for Python 14.1.0. This version adds new interfaces for managing and removing table styles. Additionally, it resolves an issue where enabling track changes and replacing text produced incorrect results. More details are listed below.
Here is a list of changes made in this release
| Category | ID | Description |
| Optimization | - | Chart namespace updated:
// Old import (deprecated): from spire.doc.charts import ChartType // New import (use this): from spire.doc.charts.ChartType import ChartType |
| New feature | - | The Bookmark class now includes FirstColumn and LastColumn properties to retrieve the starting and ending column indices of a bookmark within a table.
doc = Document() doc.LoadFromFile(inputFile) firstColumn = doc.Bookmarks["t_insert"].FirstColumn lastColumn = doc.Bookmarks["t_insert"].LastColumn |
| New feature | - | The TableFormat class now supports Style, StyleOptions, and StyleName properties for managing table styles.
doc = Document()
tableStyle = doc.Styles.Add(StyleType.TableStyle, "TestTableStyle3")
tableStyle.LeftIndent = 55
tableStyle.Borders.Color = Color.get_Green()
tableStyle.HorizontalAlignment = RowAlignment.Right
tableStyle.Borders.BorderType = BorderStyle.Single
section = doc.AddSection()
table = section.AddTable()
table.ResetCells(3, 3)
table.Rows[0].Cells[0].AddParagraph().AppendText("Aligned according to left indent")
table.PreferredWidth = PreferredWidth.FromPoints(300)
table.Format.StyleName = "TestTableStyle3"
style = doc.Styles.FindByName("TestTableStyle3")
if (style is not None) and isinstance(style, TableStyle):
tableStyle = style
tableStyle.Borders.Color = Color.get_Black()
tableStyle.Borders.BorderType = BorderStyle.Double
tableStyle.RowStripe = 3
tableStyle.ConditionalStyles[TableConditionalStyleType.OddRowStripe].Shading.BackgroundPatternColor = Color.get_LightBlue()
tableStyle.ConditionalStyles[TableConditionalStyleType.EvenRowStripe].Shading.BackgroundPatternColor = Color.get_LightCyan()
tableStyle.ColumnStripe = 1
tableStyle.ConditionalStyles[TableConditionalStyleType.EvenColumnStripe].Shading.BackgroundPatternColor = Color.get_LightPink()
table.ApplyStyle(tableStyle)
table.Format.StyleOptions = table.Format.StyleOptions | TableStyleOptions.ColumnStripe
doc.SaveToFile(outputFile, FileFormat.Docx)
|
| New feature | - | The Style class now includes a RemoveSelf method to remove the style from the document.
style = doc.Styles.FindByName("TestTableStyle3")
style.RemoveSelf()
|
| New feature | - | Enhanced the Document class with features including page extraction (ExtractPages), first-section access (FirstSection), and support for hyphenation dictionary registration/unregistration (RegisterHyphenationDictionary, UnregisterHyphenationDictionary, IsHyphenationDictionaryRegistered). |
| Bug | SPIREDOC-11668 | Fixed an issue where enabling track changes and replacing text produced incorrect results. |
Spire.PDF 12.1.0 enhances the conversion from PDF to Word
We're pleased to announce the release of Spire.PDF 12.1.0. This version enhances the conversion from PDF to Word. Meanwhile, some issues that occurred when converting PDF to PDF/A-3B, converting HTML to PDF, and obtaining font properties of text box fields have also been successfully fixed. Furthermore, the efficiency of timestamp requests has been optimized. More details are listed below.
Here is a list of changes made in this release
| Category | ID | Description |
| Bug | SPIREPDF-7867 | Fixes the issue where rendering effects were incorrect when converting PDF to Word. |
| Bug | SPIREPDF-7097 | Fixes the issue where content copied from the result document was incorrect after converting PDF to PDF/A-3B. |
| Bug | SPIREPDF-7841 | Fixes the page numbering style issue when using ChromeHtmlConverter to convert HTML to PDF for printing. |
| Bug | SPIREPDF-7847 | Fixes the issue where obtaining font properties of text box fields threw an "ArgumentOutOfRangeException". |
| Bug | SPIREPDF-7888 | Optimizes timestamp requests by reducing calls to timestamp servers and improving validation. |
Spire.Doc 14.1.3 enhances Word-to-PDF conversion functionality
We are pleased to announce the release of Spire.Doc 14.1.3. This version fixed several issues that caused the program to hang for an extended period of time during document layout processing and Word-to-PDF conversion. In addition, issues related to list numbering retrieval and incorrect content conversion were resolved. Details are listed below.
Here is a list of changes made in this release
| Category | ID | Description |
| Bug | SPIREDOC-10843 | Fixed the issue where the program hung for a long time when using new FixedLayoutDocument(document). |
| Bug | SPIREDOC-11532 | Fixed the issue where the program hung for a long time when converting Word documents to PDF. |
| Bug | SPIREDOC-11758 | Fixed the issue where an incorrect numbering format was returned when retrieving lists. |
| Bug | SPIREDOC-11728 SPIREDOC-11730 SPIREDOC-11731 | Fixed the issue where incorrect content was generated when converting Word documents to PDF. |
Spire.Presentation for Python 11.1.0 enhances the conversion from PPTX to PDF
We’re pleased to announce the release of Spire.Presentation for Python 11.1.0, which improves the conversion process from PPTX to PDF. This update addresses two specific PPTX to PDF issues and resolves two additional known bugs. More details are as follows.
Here is a list of changes made in this release
| Category | ID | Description |
| Bug | SPIREPPT-2859 SPIREPPT-3052 |
Fixed the issue where "ffi_prep_cif_var failed" error was thrown when using Python V12+ on macOS. |
| Bug | SPIREPPT-3028 | Fixed the issue where incorrect SVG effects occurred when importing using AddFromSVGAsShapes. |
| Bug | SPIREPPT-3046 SPIREPPT-3053 |
Fixed the issue where inconsistent chart content was found when converting PPTX to PDF. |
| Bug | SPIREPPT-3054 | Fixed the issue where charts were missing when converting PPTX to PDF. |
Spire.Doc for Java 14.1.0 supports creating, retrieving, and deleting picture bullets
We're pleased to announce the release of Spire.Doc for Java 14.1.0. This version optimizes methods related to list styles, supports creating/retrieving/deleting picture bullets, comparing two ListLevel objects, and creating single-level as well as multi-level lists from built-in templates. Additionally, several issues that occurred when converting Word to PDF and MHT to PDF have also been successfully fixed. More details are listed below.
Here is a list of changes made in this release
| Category | ID | Description |
| Optimization | - | Deprecated the Document.getListStyles() property, replaced it with Document.getListReferences(). |
| Optimization | - | Removed the public constructors of ListStyle. Added StyleCollection.add(ListType listType, string name) to create a ListStyle.
ListStyle listStyle = document.getStyles().add(ListType.Numbered, "levelstyle");
listStyle.isCustomStyle(true);
ListLevelCollection levels = listStyle.getListRef().getLevels();
levels.get(0).setPatternType(ListPatternType.Arabic);
levels.get(0).setStartAt(1);
levels.get(0).getCharacterFormat().setFontName("Trebuchet MS");
|
| Optimization | - | Updated the method for applying a ListStyle to a paragraph.
paragraph.getListFormat().applyStyle(ListStyle listStyle); paragraph.getListFormat().setListLevelNumber(int leverNumber) or paragraph.getListFormat().applyListRef(ListDefinitionReference list, int leverNumber); |
| Optimization | - | Removed the ListFormat.getCurrentListStyle() method, replaced it with ListFormat.getCurrentListRef(). |
| New feature | - | Added the add(ListTemplate template) method to ListCollection to create multi-level lists from built-in templates.
Document document = new Document();
Section sec = document.addSection();
Paragraph paragraph = sec.addParagraph();
// Create default bullet list template
ListTemplate template = ListTemplate.Bullet_Default;
ListDefinitionReference listRef = document.getListReferences().add(template);
// Create default numbered list template
ListTemplate template1 = ListTemplate.Number_Default;
listRef = document.getListReferences().add(template1);
listRef.getLevels().get(2).setStartAt(4);// Set the third level to start at number 4
// Add paragraph and apply numbered list style (level 2)
paragraph = sec.addParagraph();
paragraph.appendText("List Item 1");
// Apply level 2 (index starts at 0; 1 means the second level)
paragraph.getListFormat().applyListRef(listRef, 1);
paragraph = sec.addParagraph();
paragraph.appendText("List Item 2");
// Apply level 3
paragraph.getListFormat().applyListRef(listRef, 2);
paragraph = sec.addParagraph();
paragraph.appendText("List Item 3");
// Apply level 2
paragraph.getListFormat().applyListRef(listRef, 1);
paragraph = sec.addParagraph();
paragraph.appendText("List Item 4");
// Apply level 3
paragraph.getListFormat().applyListRef(listRef, 2);
document.saveToFile(outputFile, FileFormat.Docx);
document.close();
|
| New feature | - | Added the addSingleLevelList(ListTemplate listTemplate) method to ListCollection for quickly creating single-level lists.
Document document = new Document();
Section sec = document.addSection();
Paragraph paragraph = sec.addParagraph();
// Create Arabic numeral numbered list template (e.g., "1.", "2.", ...)
ListTemplate template = ListTemplate.Number_Arabic_Dot;
// Use addSingleLevelList to create a single-level list reference
ListDefinitionReference listRef = document.getListReferences().addSingleLevelList(template);
int levelcount = listRef.getLevels().getCount();//Check level count
boolean res=listRef.isMultiLevel();
// Add first list item
paragraph = sec.addParagraph();
paragraph.appendText("List Item 1");
paragraph.getListFormat().applyListRef(listRef, 0);
paragraph = sec.addParagraph();
paragraph.appendText("List Item 2");
paragraph.getListFormat().applyListRef(listRef, 0);
document.saveToFile(outputFile, FileFormat.Docx);
document.close();
|
| New feature | - | Added the ListLevel.equals(ListLevel level) method to compare whether two ListLevel objects are equal. |
| New feature | - | Added methods for creating, retrieving, and deleting picture bullets.
Document document = new Document();
Section sec = document.addSection();
Paragraph paragraph = sec.addParagraph();
// Create custom bulleted list style
ListStyle listStyle = document.getStyles().add(ListType.Bulleted, "bulletList");
// Get level configurations of this list style
ListLevelCollection Levels = listStyle.getListRef().getLevels();
// Set picture bullet for level 1
Levels.get(0).createPictureBullet();
Levels.get(0).getPictureBullet().loadImage(imag_Path_1);
// Set picture bullet for level 2
Levels.get(1).createPictureBullet();
Levels.get(1).getPictureBullet().loadImage(imag_Path_2);
// Add first list item
paragraph = sec.addParagraph();
paragraph.appendText("List Item 1");
paragraph.getListFormat().applyStyle(listStyle);
// Add second list item
paragraph = sec.addParagraph();
paragraph.appendText("List Item 1.1");
paragraph.getListFormat().applyStyle(listStyle);
paragraph.getListFormat().setListLevelNumber(1);
// Delete picture bullet for level 1
Levels.get(0).deletePictureBullet();
document.saveToFile(outputFile, FileFormat.Docx);
document.close();
|
| Bug | SPIREDOC-10843 | Fixed an issue where the application hung when processing a structured document. |
| Bug | SPIREDOC-11439 | Fixed an issue where the comparison of the table of contents failed. |
| Bug | SPIREDOC-11532 | Fixed an issue where the application hung when converting Word to PDF. |
| Bug | SPIREDOC-11605 SPIREDOC-11712 | Fixed an issue where the table layout was incorrect when converting Word to PDF. |
| Bug | SPIREDOC-11629 | Fixed an issue where text positioning was incorrect when converting Word to PDF. |
| Bug | SPIREDOC-11699 | Fixed an issue where text line wrapping was incorrect when converting Word to PDF while following WPS rules. |
| Bug | SPIREDOC-11709 | Fixed an issue where the application hung when converting MHT to PDF. |
| Bug | SPIREDOC-11741 | Fixed an issue that Avira Free Security Suite falsely detected a virus in spire.doc.jar. |
Spire.Office 10.12.0 is released
We’re pleased to announce the release of Spire.Office 10.12.0. In this version, Spire.Doc supports the "Two Lines in One" function to enhance Word to PDF conversion; Spire.XLS supports customizing export options when converting Excel to Markdown; Spire.Presentation supports compressing images; Spire.PDF supports both horizontal and vertical text alignment. Meanwhile, a series of known issues have been fixed in this update. More details are as follows.
In this version, the most recent versions of Spire.Doc, Spire.PDF, Spire.XLS, Spire.Presentation, Spire.Barcode, Spire.DocViewer, Spire.PDFViewer, and Spire.Email are included.
DLL Versions:
- Spire.Doc.dll v13.12.6
- Spire.PDF.dll v11.12.7
- Spire.XLS.dll v15.12.2
- Spire.Presentation.dll v10.12.3
- Spire.Barcode.dll v7.5.0
- Spire.Email.dll v6.8.0
- Spire.DocViewer.Forms.dll v8.9.5
- Spire.PdfViewer.Asp.dll v8.2.9
- Spire.PdfViewer.Forms.dll v8.2.9
- Spire.Spreadsheet.dll v7.5.3
- Spire.OfficeViewer.Forms.dll v8.8.1
Here is a list of changes made in this release
Spre.doc
| Category | ID | Description |
| New Feature | SPIREDOC-5504 | Supports setting the "Horizontal in Vertical" property of Paragraph text.
Document doc = new Document();
Section section = doc.AddSection();
Spire.Doc.Documents.Paragraph paragraph = section.AddParagraph();
Spire.Doc.Fields.TextRange farEastLayout = paragraph.AppendText("test");
FarEastLayout style = new FarEastLayout();
style.Vertical = true;
farEastLayout.CharacterFormat.FarEastLayout = style;
doc.SaveToFile(outputFile, FileFormat.Docx);
doc.Close();
|
| New Feature | SPIREDOC-11073 | Supports copying styles from template documents when converting Markdown to Docx.
//Load template documents with existing styles
Document temple = new Document();
temple.LoadFromFile("temple.docx");
//Load markdown file
Document doc = new Document();
doc = new Document(@"Doc.md");
//Copy styles from template documents
doc.CopyStylesFromTemplate(temple);
//Save
doc.SaveToFile(@"Doc.docx", Spire.Doc.FileFormat.Docx2016);
|
| New Feature | – | Supports the "Two Lines in One" function to enhance Word to PDF conversion. |
| New Feature | – | Supports retrieving style change revisions.
Document doc = new Document();
doc.LoadFromFile(inputFile);
RevisionInfoCollection revisionInfoCollection = doc.GetRevisionInfos();
StringBuilder sb = new StringBuilder();
foreach (RevisionInfo revisionInfo in revisionInfoCollection)
{
if (revisionInfo.RevisionType == RevisionType.FormatChange)
{
if (revisionInfo.OwnerObject is Spire.Doc.Fields.TextRange)
{
TextRange range = (TextRange)revisionInfo.OwnerObject;
sb.AppendLine("TextRange:" + range.Text + "\r\n");
doc.RevisionsView = RevisionsView.Original;
sb.AppendLine("Original style:" + "isBold:" + range.CharacterFormat.Bold + ";" + "TextColor:" + range.CharacterFormat.TextColor + ";HighlightColor:" + range.CharacterFormat.HighlightColor + ";FontName:" + range.CharacterFormat.FontName + ";UnderlineStyle:" + range.CharacterFormat.UnderlineStyle + "\r\n");
doc.RevisionsView = RevisionsView.Final;
sb.AppendLine("Final style:" + "isBold:" + range.CharacterFormat.Bold + ";" + "TextColor:" + range.CharacterFormat.TextColor + ";HighlightColor:" + range.CharacterFormat.HighlightColor + ";FontName:" + range.CharacterFormat.FontName + ";UnderlineStyle:" + range.CharacterFormat.UnderlineStyle + "\r\n");
}
}
}
File.WriteAllText(outputFile, sb.ToString());
doc.Close();
|
| New Feature | SPIREDOC-10448 | Added a CompatibilityOptions property to the Document class for performing compatibility operations on documents.
Document doc = new Document();
doc.CompatibilityOptions.UlTrailSpace = false;
doc.CompatibilityOptions.AdjustLineHeightInTable = true;
doc.CompatibilityOptions.SpaceForUL = true;
doc.CompatibilityOptions.ApplyBreakingRules = true;
doc.CompatibilityOptions.DoNotExpandShiftReturn = false;
doc.CompatibilityOptions.OverrideTableStyleFontSizeAndJustification = false;
doc.CompatibilityOptions.DoNotAutofitConstrainedTables = true;
doc.SaveToFile("outputFile");
|
| New Feature | - | Added the CompatibilityOptions class, CompatibilityTypes enumeration, and WordVersion enumeration to the Spire.Doc.Settings namespace.
Document doc = new Document();
doc.LoadFromFile("inputtFile");
Spire.Doc.Settings.CompatibilityOptions options = doc.CompatibilityOptions;
|
| New Feature | - | Added the OptimizeForWordVersion() method to the CompatibilityOptions class, enabling document compatibility to be set by specifying a Word version.
Document doc = new Document();
doc.LoadFromFile(inputFile);
// Set properties
doc.CompatibilityOptions.UlTrailSpace = false;
doc.CompatibilityOptions.AdjustLineHeightInTable = true;
doc.CompatibilityOptions.SpaceForUL = true;
doc.CompatibilityOptions.ApplyBreakingRules = true;
doc.CompatibilityOptions.DoNotExpandShiftReturn = false;
doc.CompatibilityOptions.OverrideTableStyleFontSizeAndJustification = false;
doc.CompatibilityOptions.DoNotAutofitConstrainedTables = true;
// Set FileFormat when saving to preserve effects
doc.SaveToFile(outputFile_after, FileFormat.Docx2016);
// Using version compatibility will reset previously set properties
Spire.Doc.Settings.CompatibilityOptions options = doc.CompatibilityOptions;
doc.CompatibilityOptions.OptimizeForWordVersion(WordVersion.Word2016);
PrintCompatibilityOptions(options, outputFile);
doc.Close();
|
| Bug Fix | SPIREDOC-10859 | Fixed issue with incorrect header appearance when converting Word to PDF. |
| Bug Fix | SPIREDOC-11005 | Fixed issue with loss of image transparency when converting Word to PDF/A-3B. |
| Bug Fix | SPIREDOC-11579 | Fixed issue with incorrect rendering when converting Word to PDF. |
| Bug Fix | SPIREDOC-11623 | Fixed issue where converting Word to PDF threw a "System.NullReferenceException". |
| Bug Fix | SPIREDOC-11644 | Fixed issue with incorrect fonts when converting Word to images. |
| Bug Fix | SPIREDOC-11659 | Fixed issue where copying headers threw an "Object reference not set to an instance of an object" error. |
| Bug Fix | SPIREDOC-11680 | Fixed issue where loading a signed document threw a "System.FormatException" error. |
| Bug Fix | SPIREDOC-11696 | Fixed issue where the doc.HtmlUrlLoadEvent could not be used in the latest version. |
| Bug Fix | SPIREDOC-11700 | Fixed issue with incorrect page number updates in the table of contents. |
| Bug Fix | SPIREDOC-11708 | Fixed the issue where page numbers were incorrect when converting Word documents to PDF. |
Spre.XLS
| Category | ID | Description |
| New Feature | SPIREXLS-5938, SPIREXLS-5975 | Supports customizing export options when converting Excel to Markdown.
Workbook wb = new Workbook();
wb.loadFromFile("input.xlsx");
// Create export options
MarkdownOptions options = new MarkdownOptions();
// Set whether to save images using relative paths
options.setSavePicInRelativePath(true);
// Set whether to format hyperlinks as Markdown reference-style links
options.setSaveHyperlinkAsRef(true);
wb.saveToMarkdown("output.md", options);
|
| Bug Fix | SPIREXLS-6023 | Fixes the issue where adding EMF images to headers caused an exception. |
| Bug Fix | SPIREXLS-6036 | Fixes the issue where the KeepDataType setting failed to preserve original data types. |
| Bug Fix | SPIREXLS-6038 | Fixes the issue where image quality was degraded when converting Excel to PDF. |
| Bug Fix | SPIREXLS-6043 | Fixes the issue where date formulas were calculated incorrectly in French locale. |
| Bug Fix | SPIREXLS-6046 | Fixes the issue where converting HTML to Excel threw an IOException. |
Spire.Presentation
| Category | ID | Description |
| New feature | SPIREPPT-2994 | Added support for compressing images.
Presentation presentation = new Presentation();
presentation.LoadFromFile(inputFile);
foreach (ISlide slide in presentation.Slides)
{
foreach (Spire.Presentation.IShape shape in slide.Shapes)
{
if (shape is SlidePicture)
{
SlidePicture ps = shape as SlidePicture;
// Compress the image: remove cropped areas (true) and set target resolution to 150 DPI (commonly used for web display)
ps.PictureFill.CompressImage(true, 150f);
}
}
}
presentation.SaveToFile(outputFile, FileFormat.Pptx2013);
|
| New Feature | SPIREPPT-3004 | Added support for configuring output image DPI when converting slides to images.
presentation.SaveToImage(int pageIndex, int dpiX, int dpiY); |
| Bug Fix | SPIREPPT-3016 | Fixed an issue where bullet points were rendered incorrectly after converting PPTX to PDF. |
| Bug Fix | SPIREPPT-3019 | Fixed an issue where content was clipped after converting PPTX to PDF. |
| Bug Fix | SPIREPPT-3031 | Fixed an issue where slide backgrounds were displayed incorrectly after converting PPTX to PDF. |
| Bug Fix | SPIREPPT-3048 | Fixed an issue that loading a PPTX document threw a “Object reference not set to an instance of an object.” exception. |
Spire.PDF
| Category | ID | Description |
| Adjustment | — | Enhanced the underlying rendering logic for converting PDFs to images on the WPF platform, resulting in significantly improved output image quality. |
| Optimization | SPIREPDF-7855 | Optimized slow web printing requests in the .NET Standard DLL. |
| New Feature | SPIREPDF-7826 | Deprecated the PdfFreeTextAnnotation.TextAlignment property and added the new PdfFreeTextAnnotation.StringFormat property to support horizontal and vertical text alignment.
PdfDocument newPdf = new PdfDocument();
PdfPageBase page = newPdf.Pages.Add();
Spire.Pdf.Graphics.PdfFont font = new PdfFont(PdfFontFamily.Helvetica, 10f);
SizeF textSize = font.MeasureString("sample");
RectangleF rect = new RectangleF(50,50, textSize.Width, textSize.Height);
Spire.Pdf.Annotations.PdfFreeTextAnnotation textAnnotation = new Spire.Pdf.Annotations.PdfFreeTextAnnotation(rect);
textAnnotation.Text = "sample";
textAnnotation.Subject = "subject";
textAnnotation.Font = font;
Spire.Pdf.Annotations.PdfAnnotationBorder border = new Spire.Pdf.Annotations.PdfAnnotationBorder(8);
textAnnotation.Border = border;
textAnnotation.LineEndingStyle = Spire.Pdf.Annotations.PdfLineEndingStyle.None;
textAnnotation.Size = new SizeF(textSize.Width * 1.5F, textSize.Height * 1.5F);
textAnnotation.StringFormat.Alignment = PdfTextAlignment.Center;
textAnnotation.StringFormat.LineAlignment = PdfVerticalAlignment.Middle;
page.Annotations.Add(textAnnotation);
newPdf.SaveToFile(result);
|
| Bug Fix | SPIREPDF-2261 | Fixed the issue where Arabic characters entered into form fields were displayed with incorrect text direction. |
| Bug Fix | SPIREPDF-4834 | Fixed the issue where content became inconsistent when converting XPS to PDF. |
| Bug Fix | SPIREPDF-6712, SPIREPDF-6873 | Fixed the issue where Arabic and Hebrew text rendered incorrectly when converting PDF to PDF/A-3a. |
| Bug Fix | SPIREPDF-7526 | Fixed the issue where text blocks were unnecessarily split into multiple lines during PDF-to-PPTX conversion. |
| Bug Fix | SPIREPDF-7816 | Fixed the issue where removing annotation borders had no effect. |
| Bug Fix | SPIREPDF-7828 | Fixed the issue where a System.Exception was thrown during OFD-to-PDF conversion. |
| Bug Fix | SPIREPDF-7810 | Fixed the issue where converting PDF files with annotations to images threw an “ArgumentException”. |
| Bug Fix | SPIREPDF-7856 | Fixed the issue where converting OFD files to PDF threw a “NullReferenceException”. |
| Bug Fix | SPIREPDF-7858 | Fixed the issue where the .NET Standard DLL printed PDF documents to an incorrect output path when using a virtual printer. |
| Bug Fix | SPIREPDF-7872 | Fixed the issue where converting PDF files to PPTX threw a “Parameter is not valid.” exception. |