Spire.Doc for Python 14.6.1 improves document processing and chart operation capabilities

Spire.Doc for Python 14.6.1 improves document processing and chart operation capabilities

2026-06-08 08:59:00

We're pleased to announce the release of Spire.Doc for Python 14.6.1. This version introduces several new interfaces for processing documents and charts. Key capabilities include extracting X-axis and Y-axis values from charts, directly exporting Word files to XLSX format, and inserting SmartArt graphics into paragraphs. Moreover, an issue that occurred when converting Word to PDF has also been successfully fixed. More details are listed below.

Here is a list of changes made in this release

Category ID Description
New Feature - The CharacterFormat class adds the Kerning property to support setting character kerning.
textRange.CharacterFormat.Kerning = kerningValue
New Feature - The Chart class adds a method to get the X-axis data values, and the ChartSeries class adds a method to get the Y-axis data values.
doc = Document()
doc.LoadFromFile(inputFile)
sb = []
number = 1
for i in range(doc.Sections.Count):
sec = doc.Sections.get_Item(i)
for j in range(sec.Paragraphs.Count):
paragraph = sec.Paragraphs.get_Item(j)
for k in range(paragraph.ChildObjects.Count):
obj = paragraph.ChildObjects[k]
if isinstance(obj, ShapeObject):
shape = obj
chart = shape.Chart
sb.append("\r\n\r\nPage " + str(number) + ":\r\n" + "Get all X-axis data:")
# X-axis
for x in range(chart.XValues.Count):
xVal = chart.XValues[x]
sb.append(str(xVal.StringValue) + " ")
# Y-axis of the first series
series = chart.Series[0]
sb.append("\r\nGet Y-axis data:")
for i in range(series.YValues.Count):
yVal = series.YValues.get_Item(i)
sb.append(str(yVal.Value) + " ")
number += 1
# Write to file
File.WriteAllText(outputFile, "".join(sb))
doc.Dispose()
New Feature - Both the ChartDataLabel and ChartDataLabelCollection classes add the Position property to support setting the position of chart data labels.
chart.Series[0].DataLabels.Position = position
New Feature - The CompareOptions class adds multiple comparison option properties to support flexible ignoring of various elements or format changes during document comparison.
doc1 = Document()
doc1.LoadFromFile(inputFile_1)
doc2 = Document()
doc2.LoadFromFile(inputFile_2)
options = CompareOptions()
options = CompareOptions()
options.IgnoreCaseChanges = True
options.IgnoreComments = True
options.IgnoreFields = True
options.IgnoreFootnotes = True
options.IgnoreTables = True
options.IgnoreTextboxes = True
doc1.Compare(doc2, "user", DateTime(), options)
# Save the comparison document
doc1.SaveToFile(outputFile, FileFormat.Docx2013)
doc1.Close()
doc2.Close()
New Feature - The Document class adds the GetRevisionInfos method and the RevisionsView property to support obtaining document revision information and controlling the revision view.
doc = Document()
doc.LoadFromFile(inputFile)
revisionInfoCollection = doc.GetRevisionInfos()
sb = []
for revisionIndex in range(revisionInfoCollection.Count):
revisionInfo = revisionInfoCollection.get_Item(revisionIndex)
if revisionInfo.RevisionType == RevisionType.FormatChange:
if isinstance(revisionInfo.OwnerObject, TextRange):
text_range = revisionInfo.OwnerObject
sb.append("TextRange:" + text_range.Text + "\r\n")
doc.RevisionsView = RevisionsView.Original
sb.append("Original style: " + "isBold: " + str(text_range.CharacterFormat.Bold) + "; " + "TextColor: " + text_range.CharacterFormat.TextColor.ToString() + ", HighlightColor: " + text_range.CharacterFormat.HighlightColor.ToString() + ", FontName: " + str(text_range.CharacterFormat.FontName) + ", UnderlineStyle: " + str(text_range.CharacterFormat.UnderlineStyle) + "\r\n")
doc.RevisionsView = RevisionsView.Final
sb.append("Final style: " + "isBold: " + str(text_range.CharacterFormat.Bold) + "; " + "TextColor: " + text_range.CharacterFormat.TextColor.ToString() + ", HighlightColor: " + text_range.CharacterFormat.HighlightColor.ToString() + ", FontName: " + str(text_range.CharacterFormat.FontName) + ", UnderlineStyle: " + str(text_range.CharacterFormat.UnderlineStyle) + "\r\n")
File.WriteAllText(outputFile, "\n".join(sb))
doc.Close()
New Feature - The SaveToFile method adds a new parameter to support directly saving Word documents as XLSX format.
document = Document()
document.LoadFromFile(inputFile)
document.SaveToFile(outputFile, FileFormat.XLSX)
document.Close()
New Feature - The Document class adds the CompatibilityOptions property to support obtaining document compatibility options.
options = doc.CompatibilityOptions
New Feature - The Fill class adds the SetImage method and the FillType property to support setting fill images and obtaining fill types.
# add node
node_new = smartArt.Nodes.Add()
node_new.Text = "Map"
shapeProperties = node_new.ShapeProperties[0]
# Set the fill color of the shape
shapeProperties.Fill.FillType = FillType.Picture
picFileStream = Stream("Image/0.jpg")
# Set the image
shapeProperties.Fill.SetImage(picFileStream)
New Feature - The Paragraph class adds the AppendSmartArt method to support appending SmartArt graphics in paragraphs.
shape = paragraph.AppendSmartArt(SmartArtType.RepeatingBendingProcess, 432, 252)
New Feature - The ParagraphFormat class adds the AdjustRightIndent method to support controlling whether to automatically adjust the right indent of a paragraph.
paragraph.Format.AdjustRightIndent = True
New Feature - The Shape class adds the HasSmartArt property and the SmartArt property to support determining whether a shape contains SmartArt and obtaining the object.
hasSmartArt=shape.HasSmartArt
smartArt = shape.SmartArt
New Feature - The TableRow class adds the Hidden property to support setting or obtaining the hidden state of a table row.
firstRow.Hidden = True
New Feature - The ToPdfParameterList class adds the GeneratorName property to support customizing the generator name when converting Word to PDF.
doc = Document()
toPdf = ToPdfParameterList()
toPdf.GeneratorName = genName
doc.LoadFromFile(inputFile)
doc.SaveToFile(outputFile, toPdf)
Bug Fix SPIREDOC-11858 Fixed an issue where the program threw an “ArgNullReferenceException” when converting Word to PDF.
Click the link to download Spire.Doc for Python 14.6.1: