We're pleased to announce the release of Spire.Doc 14.3. This update introduces support for the “Automatically adjust right indent when defining grid” and "Kerning for fonts" features, along with several new interfaces for adding and manipulating SmartArt graphics. Additionally, three issues affecting Word document processing have been resolved. More details are listed below.
Here is a list of changes made in this release
| Category | ID | Description |
| New Feature | SPIREDOC-9870 | Added support for the "Automatically adjust right indent when defining grid" feature.
paragraph.Format.AdjustRightIndent = true; // Default value is true |
| New Feature | SPIREDOC-11030 | Added support for the "Kerning for fonts" feature.
textRange.CharacterFormat.Kerning = 2.5f; |
| New Feature | SPIREDOC-10514 SPIREDOC-11494 | Added several new interfaces for adding and manipulating SmartArt graphics.
Document document = new Document();
Section section = document.AddSection();
Spire.Doc.Documents.Paragraph paragraph = section.AddParagraph(); paragraph.Format.HorizontalAlignment = HorizontalAlignment.Center;
Spire.Doc.Fields.TextRange textRange = paragraph.AppendText("RepeatingBendingProcess");
textRange.CharacterFormat.FontSize = 28f;
textRange.CharacterFormat.FontName = "Times New Roman";
paragraph = section.AddParagraph();
paragraph = section.AddParagraph();
paragraph.Format.HorizontalAlignment = HorizontalAlignment.Center;
// Add SmartArt with "Segmented Process" layout
Spire.Doc.Fields.Shapes.Shape shape = paragraph.AppendSmartArt(SmartArtType.RepeatingBendingProcess, 432, 252);
SmartArt repeatingBendingSmartArt = shape.SmartArt;
// Add node text
SmartArtNode process1 = repeatingBendingSmartArt.Nodes[0];
process1.Text = "1";
((Spire.Doc.Fields.TextRange)process1.Paragraphs[0].ChildObjects[0]).CharacterFormat.FontName = "Calibri";
((Spire.Doc.Fields.TextRange)process1.Paragraphs[0].ChildObjects[0]).CharacterFormat.FontSize = 20f;
((Spire.Doc.Fields.TextRange)process1.Paragraphs[0].ChildObjects[0]).CharacterFormat.TextColor = Color.Crimson;
// Add node text
SmartArtNode process2 = repeatingBendingSmartArt.Nodes[1];
process2.Text = "2";
((Spire.Doc.Fields.TextRange)process2.Paragraphs[0].ChildObjects[0]).CharacterFormat.FontSize = 15f;
// Add node text
SmartArtNode process3 = repeatingBendingSmartArt.Nodes[2];
process3.Text = "3";
((Spire.Doc.Fields.TextRange)process3.Paragraphs[0].ChildObjects[0]).CharacterFormat.FontSize = 10f;
// Add node text
SmartArtNode process4 = repeatingBendingSmartArt.Nodes[3];
process4.Text = "4";
((Spire.Doc.Fields.TextRange)process4.Paragraphs[0].ChildObjects[0]).CharacterFormat.FontSize = 10f;
// Add node text
SmartArtNode process5 = repeatingBendingSmartArt.Nodes[4];
process5.Text = "5";
((Spire.Doc.Fields.TextRange)process5.Paragraphs[0].ChildObjects[0]).CharacterFormat.FontSize = 10f;
document.SaveToFile(outputFile, FileFormat.Docx);
document.Close();
|
| New Feature | SPIREDOC-11622 | Added support for retrieving text from all nodes in SmartArt.
using (Document document = new Document(inputFile))
{
// Iterate through all sections
foreach (Section section in document.Sections)
{
if (section?.Paragraphs == null) continue;
// Iterate through all paragraphs in the section
foreach (Spire.Doc.Documents.Paragraph paragraph in section.Paragraphs)
{
foreach (var childObj in paragraph.ChildObjects)
{
if (childObj is Spire.Doc.Fields.Shapes.Shape shape && shape.HasSmartArt)
{
SmartArt smartArt = shape.SmartArt;
if (smartArt == null) continue;
TraverseSmartArtNodes(smartArt.Nodes, builder, 0);
}
}
}
}
}
public static void TraverseSmartArtNodes(SmartArtNodeCollection nodes, StringBuilder builder, int level)
{
if (nodes == null || nodes.Count == 0) return;
for (int nodeIdx = 0; nodeIdx < nodes.Count; nodeIdx++)
{
SmartArtNode node = nodes[nodeIdx];
if (node == null) continue;
// Clean node text
string nodeText = node.Text != null ? node.Text.Trim() : "Empty Text";
if (nodeText == "\r" || string.IsNullOrEmpty(nodeText)) continue;
// Concatenate node level identifier
string nodePrefix;
switch (level)
{
case 0:
nodePrefix = "smartArt.Nodes";
break;
case 1:
nodePrefix = "smartArt.Nodes.ChildNodes";
break;
case 2:
nodePrefix = "smartArt.Nodes.ChildNodes.ChildNodes";
break;
default:
nodePrefix = $"smartArt.Nodes.Level{level}";
break;
}
// Basic text output
builder.AppendLine($"{nodePrefix}_{nodeIdx}: {nodeText}");
// Recursively process child nodes
TraverseSmartArtNodes(node.ChildNodes, builder, level + 1);
}
}
|
| Bug Fix | SPIREDOC-11724 | Fixed the issue where paragraph text was retrieved incorrectly. |
| Bug Fix | SPIREDOC-11743 | Fixed the issue where Arabic text fonts were altered when converting Word to PDF. |
| Bug Fix | SPIREDOC-11787 | Fixed the issue where extra blank pages appeared during page extraction. |
Click the link to download Spire.Doc 14.3:
More information of Spire.Doc new release or hotfix: