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. |
Click the link to download Spire.Doc for Python 14.1.0: