We are excited to announce the release of Spire.Doc for Python 12.12.0. The latest version supports setting the gutter position in a Word document. Besides, some known issues are fixed successfully in this update, such as the issue that the program threw "Arg_InvalidCastException" when adding a LaTeX formula. More details are listed below.
Here is a list of changes made in this release
| Category | ID | Description |
| New feature | SPIREDOC-10347 | Supports marking Word documents as 'final'.
from spire.doc import *
from spire.doc.common import *
document = Document()
document.LoadFromFile("in.docx")
customProperties = document.CustomDocumentProperties
customProperties.Add("_MarkAsFinal", Boolean(True))
document.SaveToFile("out.docx", FileFormat.Docx2013)
|
| New feature | SPIREDOC-10401 | Supports setting the gutter position in a Word document.
from spire.doc import *
from spire.doc.common import *
document = Document()
sec = None
for i in range(0, 10):
sec = document.AddSection()
sec.PageSetup.IsTopGutter = False
para = sec.AddParagraph()
txtRange = para.AppendText("Test")
sec.PageSetup.Gutter = 50 + i*10
document.SaveToFile(outputFile, FileFormat.Docx)
document.Close()
|
| New feature | SPIREDOC-10555 | Supports setting custom font folders.
from spire.doc import * from spire.doc.common import * document = Document() document.LoadFromFile(inputFile) document.SetCustomFontsFolders(document,"Angsana New") document.SaveToFile(outputFile, FileFormat.PDF) document.Close() |
| New feature | SPIREDOC-10817 | Supports setting authors for the revision.
from spire.doc import *
from spire.doc.common import *
document = Document()
#Load the file from disk.
document.LoadFromFile(inputFile)
for i in range(document.Sections.Count):
sec = document.Sections.get_Item(i)
#Iterate through the element under body in the section
for j in range(sec.Body.ChildObjects.Count):
docItem = sec.Body.ChildObjects.get_Item(j)
if isinstance(docItem, Paragraph):
para = docItem
if para.IsInsertRevision:
para.InsertRevision.Author="Spire.Doc Insert"
elif para.IsDeleteRevision:
para.DeleteRevision.Author="Spire.Doc Insert"
for k in range(para.ChildObjects.Count):
textRange = para.ChildObjects.get_Item(k)
if isinstance(textRange, TextRange):
if textRange.IsInsertRevision:
textRange.InsertRevision.Author="Spire.Doc Insert"
elif textRange.IsDeleteRevision:
textRange.DeleteRevision.Author="Spire.Doc Insert"
#Save to file.
document.SaveToFile(outputFile, FileFormat.Docx2013)
document.Close()
|
| Bug | SPIREDOC-10294 SPIREDOC-10863 |
Fixes the issue that the program threw "Arg_InvalidCastException" when adding a LaTeX formula. |
| Bug | SPIREDOC-10533 | Fixes the issue that the program threw "AttributeError" when using CustomDocumentProperties.Add() method. |
| Bug | SPIREDOC-10655 | Fixes the issue that the program threw "AttributeError" when setting PageSetup.GridType |
| Bug | SPIREDOC-10779 | Fixes the issue that incorrect returns occurred when using 'FixedLayoutPage.Section'. |
Click the link to download Spire.Doc for Python 12.12.0: