Add Beautiful Combo Charts
Aspose.Words for .NET 24.5 allows developers to seamlessly combine different chart types like bar and line for a comprehensive data view. The following C# code example demonstrates creating combo charts with a secondary Y axis inside an MS Word (DOCX) document.
// 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);
Shape shape = builder.InsertChart(ChartType.Line, 450, 250);
Chart chart = shape.Chart;
ChartSeriesCollection series = chart.Series;
// Delete default generated series.
series.Clear();
string[] categories = new string[] { "Category 1", "Category 2", "Category 3" };
series.Add("Series 1 of primary series group", categories, new double[] { 2, 3, 4 });
series.Add("Series 2 of primary series group", categories, new double[] { 5, 2, 3 });
// Create an additional series group, also of the line type.
ChartSeriesGroup newSeriesGroup = chart.SeriesGroups.Add(ChartSeriesType.Line);
// Specify the use of secondary axes for the new series group.
newSeriesGroup.AxisGroup = AxisGroup.Secondary;
// Hide the secondary X axis.
newSeriesGroup.AxisX.Hidden = true;
// Define title of the secondary Y axis.
newSeriesGroup.AxisY.Title.Show = true;
newSeriesGroup.AxisY.Title.Text = "Secondary Y axis";
// Add a series to the new series group.
ChartSeries series3 =
newSeriesGroup.Series.Add("Series of secondary series group", categories, new double[] { 13, 11, 16 });
series3.Format.Stroke.Weight = 3.5;
doc.Save(ArtifactsDir + "Charts.SecondaryAxis.docx");
Source*
Insert SoftEdge
Effects
You can now add custom blur radius of a shape’s edges for a softer appearance within your Word documents. Please check out the following C# code sample that showcases how to add the soft edge effect to a shape:
// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-.NET.git.
DocumentBuilder builder = new DocumentBuilder();
Shape shape = builder.InsertShape(ShapeType.Rectangle, 200, 200);
// Apply soft edge to the shape.
shape.SoftEdge.Radius = 30;
builder.Document.Save(ArtifactsDir + "Shape.SoftEdge.docx");
// Load document with rectangle shape with soft edge.
Document doc = new Document(ArtifactsDir + "Shape.SoftEdge.docx");
shape = (Shape)doc.GetChild(NodeType.Shape, 0, true);
// Check soft edge radius.
Assert.AreEqual(30, shape.SoftEdge.Radius);
// Remove soft edge from the shape.
shape.SoftEdge.Remove();
// Check radius of the removed soft edge.
Assert.AreEqual(0, shape.SoftEdge.Radius);
Source*
.NET Framework 7.0 and 8.0 Support
With this release of the .NET Word documents API, users can utilize the .NET framework versions 7.0 and 8.0 for seamless integration with software components built using a .NET framework version of their choice.
Optimized SVG Exports
Experience better control over SVG exports with the help of the newly added SvgSaveOptions.MaxImageResolution
property, which lets you set the output SVG image resolution value in pixels per inch. This code example highlights the property usage:
// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-.NET.git.
Document doc = new Document(MyDir + "Rendering.docx");
SvgSaveOptions saveOptions = new SvgSaveOptions();
saveOptions.MaxImageResolution = 72;
doc.Save(ArtifactsDir + "SvgSaveOptions.MaxImageResolution.svg", saveOptions);
Source*
Check For VBA Macros Presence
Using a new feature added in the latest API version, you can examine the document content for the presence of VBA macros without loading the document using the newly introduced FileFormatInfo.HasMacros
property. Please refer to the following code snippet to learn how to use this feature:
// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-.NET.git.
FileFormatInfo fileFormatInfo = FileFormatUtil.DetectFileFormat(MyDir + "Macro.docm");
Assert.IsTrue(fileFormatInfo.HasMacros);
Source*
Improved LINQ Reporting Engine
This version of the C# Word apps API supports maintaining source numbering while inserting a document using the LINQ reporting engine. The C# coding sample shared below illustrates how to use this feature:
// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-.NET.git.
// By default, numbered lists from a template document are continued when their identifiers match those from a document being inserted.
// With "-sourceNumbering" numbering should be separated and kept as is.
Document template = DocumentHelper.CreateSimpleDocument("<<doc [src.Document]>>" + Environment.NewLine + "<<doc [src.Document] -sourceNumbering>>");
DocumentTestClass doc = new DocumentTestBuilder()
.WithDocument(new Document(MyDir + "List item.docx")).Build();
ReportingEngine engine = new ReportingEngine() { Options = ReportBuildOptions.RemoveEmptyParagraphs };
engine.BuildReport(template, new object[] { doc }, new[] { "src" });
template.Save(ArtifactsDir + "ReportingEngine.SourseListNumbering.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.5 Release Notes.