We're pleased to announce the release of Spire.Doc 13.9.10. This version exposes several core interfaces for fine-grained document styling control, and supports removing document style as well as applying built-in table styles. More details are listed below.
Here is a list of changes made in this release
| Category | ID | Description |
| New feature | - | Exposes core style interfaces ICharacterStyle, IListStyle, and ITableStyle to enable fine-grained document styling control. |
| New feature | SPIREDOC-7186 SPIREDOC-7365 | Removes CharacterFormat from IStyle, now implemented in CharacterStyle, ParagraphStyle, and TableStyle.
IStyle style = document.Styles.FindByName("Normal");
if (style != null && style is ICharacterStyle)
{
ICharacterStyle cStyle = style as ICharacterStyle;
cStyle.CharacterFormat.FontName = "cambria";
cStyle.CharacterFormat.FontSize = 14;
cStyle.CharacterFormat.Bold = true;
cStyle.CharacterFormat.TextColor = Color.FromArgb(42, 123, 136);
}
|
| New feature | SPIREDOC-2945 SPIREDOC-4871 | Adds the IStyle.RemoveSelf() method to remove a style from the document.
string pStyleName = "testStyle";
Document document = new Document();
ParagraphStyle pStyle = (ParagraphStyle)document.Styles.Add(StyleType.ParagraphStyle, pStyleName);
pStyle.CharacterFormat.FontName = "Calibri";
pStyle.CharacterFormat.FontSize = 16;
pStyle.CharacterFormat.Bold = true;
pStyle.CharacterFormat.TextColor = Color.DarkRed;
Section section = document.AddSection();
Paragraph para = section.AddParagraph();
para.ApplyStyle(pStyle);
para.AppendText("Hello world!");
Style firstParaStyle = document.FirstSection.Body.FirstParagraph.Format.Style;
document.SaveToFile(outputDocxFile1, FileFormat.Docx);
document.Styles[pStyleName].RemoveSelf();
document.SaveToFile(outputDocxFile2, FileFormat.Docx);
|
| New feature | - | Enables conditional table formatting via TableConditionalStyle, TableConditionalStyleCollection, and TableConditionalStyleType to style odd/even rows and columns.
Document doc = new Document();
Section section = doc.AddSection();
Table table = section.AddTable();
table.ResetCells(15, 4);
for (int i = 0; i < 15; i++)
{
TableRow row = table.Rows[i];
for (int j = 0; j < 4; j++)
{
TableCell cell = row.Cells[j];
cell.AddParagraph().AppendText(string.Format("{0} column.", (j % 2 == 0 ? "Even" : "Odd")));
cell.AddParagraph().AppendText(string.Format("Row banding {0}", (i % 3 == 0 ? "start" : "continuation")));
}
}
TableStyle tableStyle = (TableStyle)doc.Styles.Add(StyleType.TableStyle, "TestTableStyle1");
tableStyle.Borders.Color = Color.Black;
tableStyle.Borders.BorderType = BorderStyle.Double;
tableStyle.RowStripe = 3;
tableStyle.ConditionalStyles[TableConditionalStyleType.OddRowStripe].Shading.BackgroundPatternColor = Color.LightBlue;
tableStyle.ConditionalStyles[TableConditionalStyleType.EvenRowStripe].Shading.BackgroundPatternColor = Color.LightCyan;
tableStyle.ColumnStripe = 1;
tableStyle.ConditionalStyles[TableConditionalStyleType.EvenColumnStripe].Shading.BackgroundPatternColor = Color.LightPink;
table.ApplyStyle(tableStyle);
table.Format.StyleOptions = table.Format.StyleOptions | TableStyleOptions.ColumnStripe;
doc.SaveToFile(outputDocxFile1, FileFormat.Docx);
|
| New feature | - | Obsoletes the Table.TableStyleName and replaces it with Table.Format.StyleName. Adds Table.Format.Style and Table.ApplyStyle(ITableStyle) for applying styles to tables. |
| New feature | SPIREDOC-3647 | Exposes Style, StyleOptions, and StyleName properties in TableFormat, with TableStyleOptions enum support.
Document doc = new Document();
Section section = doc.AddSection();
TableStyle tableStyle = (TableStyle)doc.Styles.Add(StyleType.TableStyle, "TestTableStyle1");
tableStyle.HorizontalAlignment = RowAlignment.Center;
tableStyle.Borders.Color = Color.Blue;
tableStyle.Borders.BorderType = BorderStyle.Single;
Table table = section.AddTable();
table.ResetCells(1, 1);
table.Rows[0].Cells[0].AddParagraph().AppendText("Aligned to the center of the page");
table.PreferredWidth = PreferredWidth.FromPoints(300);
table.ApplyStyle(tableStyle);
section.AddParagraph().AppendText(" ");
tableStyle = (TableStyle)doc.Styles.Add(StyleType.TableStyle, "TestTableStyle2");
tableStyle.LeftIndent = 55;
tableStyle.Borders.Color = Color.Green;
tableStyle.Borders.BorderType = BorderStyle.Single;
table = section.AddTable();
table.ResetCells(1, 1);
table.Rows[0].Cells[0].AddParagraph().AppendText("Aligned according to left indent");
table.PreferredWidth = PreferredWidth.FromPoints(300);
table.Format.Style = tableStyle;
doc.SaveToFile(outputDocxFile1, FileFormat.Docx);
|
| New feature | - | Adds Document.AddStyle(DefaultTableStyle) method to apply built-in table styles.
Document doc = new Document();
Section section = doc.AddSection();
Table table = section.AddTable();
table.ResetCells(15, 4);
for (int i = 0; i < 15; i++)
{
TableRow row = table.Rows[i];
for (int j = 0; j < 4; j++)
{
TableCell cell = row.Cells[j];
cell.AddParagraph().AppendText(string.Format("{0} column.", (j % 2 == 0 ? "Even" : "Odd")));
cell.AddParagraph().AppendText(string.Format("Row banding {0}", (i % 2 == 0 ? "Even" : "Odd")));
}
}
TableStyle tableStyle = doc.AddStyle(DefaultTableStyle.LightListAccent3);
table.ApplyStyle(tableStyle);
doc.SaveToFile(outputDocxFile1, FileFormat.Docx);
|
Click the link to download Spire.Doc 13.9.10:
More information of Spire.Doc new release or hotfix: