Aspose.Words for .NET 24.6 (MSI) brings several improvements and new features to enhance your document processing capabilities on the Windows platform. Build high-performance Word document processing apps with version 24.6 of the C# Words API, which offers a wide variety of useful features.
Upgraded Charts
.NET developers can now generate Treemap, Sunburst, Histogram, Pareto, Box & Whisker, Waterfall, and Funnel charts with this release to represent their data with more visual impact. This code snippet showcases how to create a Treemap chart in C#:
// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-.NET.git.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Insert a Treemap chart.
Shape shape = builder.InsertChart(ChartType.Treemap, 450, 280);
Chart chart = shape.Chart;
chart.Title.Text = "World Population";
// Delete default generated series.
chart.Series.Clear();
// Add a series.
ChartSeries series = chart.Series.Add(
"Population by Region",
new ChartMultilevelValue[]
{
new ChartMultilevelValue("Asia", "China"),
new ChartMultilevelValue("Asia", "India"),
new ChartMultilevelValue("Asia", "Indonesia"),
new ChartMultilevelValue("Asia", "Pakistan"),
new ChartMultilevelValue("Asia", "Bangladesh"),
new ChartMultilevelValue("Asia", "Japan"),
new ChartMultilevelValue("Asia", "Philippines"),
new ChartMultilevelValue("Asia", "Other"),
new ChartMultilevelValue("Africa", "Nigeria"),
new ChartMultilevelValue("Africa", "Ethiopia"),
new ChartMultilevelValue("Africa", "Egypt"),
new ChartMultilevelValue("Africa", "Other"),
new ChartMultilevelValue("Europe", "Russia"),
new ChartMultilevelValue("Europe", "Germany"),
new ChartMultilevelValue("Europe", "Other"),
new ChartMultilevelValue("Latin America", "Brazil"),
new ChartMultilevelValue("Latin America", "Mexico"),
new ChartMultilevelValue("Latin America", "Other"),
new ChartMultilevelValue("Northern America", "United States"),
new ChartMultilevelValue("Northern America", "Other"),
new ChartMultilevelValue("Oceania")
},
new double[]
{
1409670000, 1400744000, 279118866, 241499431, 169828911, 123930000, 112892781, 764000000,
223800000, 107334000, 105914499, 903000000,
146150789, 84607016, 516000000,
203080756, 129713690, 310000000,
335893238, 35000000,
42000000
});
// Show data labels.
series.HasDataLabels = true;
series.DataLabels.ShowValue = true;
series.DataLabels.ShowCategoryName = true;
string thousandSeparator = CultureInfo.CurrentCulture.NumberFormat.CurrencyGroupSeparator;
series.DataLabels.NumberFormat.FormatCode = $"#{thousandSeparator}0";
doc.Save(ArtifactsDir + "Charts.Treemap.docx");
Source*
Gain better control over the visual appearance of your documents by adjusting shadow colors for shapes within your word-processing applications, as highlighted in the following code example:
// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-.NET.git.
Document doc = new Document(MyDir + "Shadow color.docx");
Shape shape = (Shape)doc.GetChild(NodeType.Shape, 0, true);
Assert.AreEqual(Color.Red.ToArgb(), shape.ShadowFormat.Color.ToArgb());
Source*
Advanced Comparison Options
The latest release of Aspose.Words for .NET helps you streamline data analysis with new options to ignore irrelevant differences during document comparisons. This code sample illustrates the comparison of two DOCX documents in C#:
// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-.NET.git.
Document docA = new Document(MyDir + "Document with SDT 1.docx");
Document docB = new Document(MyDir + "Document with SDT 2.docx");
// Configure options to compare SDT with same content but different store item id.
CompareOptions compareOptions = new CompareOptions();
compareOptions.AdvancedOptions.IgnoreStoreItemId = false;
docA.Compare(docB, "user", DateTime.Now, compareOptions);
Assert.AreEqual(8, docA.Revisions.Count);
compareOptions.AdvancedOptions.IgnoreStoreItemId = true;
docA.Revisions.RejectAll();
docA.Compare(docB, "user", DateTime.Now, compareOptions);
Assert.AreEqual(0, docA.Revisions.Count);
Source*
You can now access timestamps for comments easily, allowing for better organization and tracking of revisions. This C# code example illustrates the feature usage:
// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-.NET.git.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
DateTime dateTime = DateTime.Now;
Comment comment = new Comment(doc, "John Doe", "J.D.", dateTime);
comment.SetText("My comment.");
builder.CurrentParagraph.AppendChild(comment);
doc.Save(ArtifactsDir + "Comment.UtcDateTime.docx");
doc = new Document(ArtifactsDir + "Comment.UtcDateTime.docx");
comment = (Comment)doc.GetChild(NodeType.Comment, 0, true);
// DateTimeUtc return data without milliseconds.
Assert.AreEqual(dateTime.ToUniversalTime().ToString("yyyy-MM-dd hh:mm:ss"), comment.DateTimeUtc.ToString("yyyy-MM-dd hh:mm:ss"));
Source*
This release of the C# Word document library allows you to experience significantly faster rendering times for documents containing small background elements.
Realistic Gradients for Shapes
Create DML shapes with nonlinear gradients in your C# and VB.NET solutions and mimic the visual style of MS Word for a polished look.
LINQ Reporting Engine Improvements
We have enhanced the LINQ reporting engine, and it now supports selectively removing empty paragraphs and defining custom messages for missing object members for cleaner and more informative reports. Please check out the following code sample, which shows the selective removal of paragraphs from DOCX documents in C#:
// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-.NET.git.
// Template contains tags with an exclamation mark. For such tags, empty paragraphs will be removed.
Document doc = new Document(MyDir + "Reporting engine template - Selective remove paragraphs.docx");
ReportingEngine engine = new ReportingEngine();
engine.BuildReport(doc, false, "value");
doc.Save(ArtifactsDir + "ReportingEngine.SelectiveDeletionOfParagraphs.docx");
Source*
You can view the list of all new features, enhancements, and bug fixes introduced in this release by visiting Aspose.Words for .NET 24.6 Release Notes.