Programmatically Update TextBox OLE Control Content
This release of the C# API includes a new property named Text
incorporated into the TextBoxControl
class.
With the help of this feature addition, developers can seamlessly enhance the document editing capabilities of their .NET solutions.
The following C# code example shares how to use this feature with the Aspose.Words for .NET API:
// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-.NET.git.
Document doc = new Document(MyDir + "Textbox control.docm");
Shape shape = (Shape)doc.GetChild(NodeType.Shape, 0, true);
TextBoxControl textBoxControl = (TextBoxControl)shape.OleFormat.OleControl;
Assert.AreEqual("Aspose.Words test", textBoxControl.Text);
textBoxControl.Text = "Updated text";
Assert.AreEqual("Updated text", textBoxControl.Text);
Source*
Apply Custom Stroke Colors to Shapes in Word Documents
- To manipulate the theme and tint shades of strokes in different shapes,
ForeThemeColor
, BackThemeColor
, ForeTintAndShade
, and BackTintAndShade
public properties have been added to the Stroke
class.
You can effortlessly set the foreground and background colors of the stroke using this handy feature.
Please check the following C# sample coding to learn how to use the Aspose API to create a new document, add a textbox, set its stroke foreground color, and save the document in DOCX format:
// 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.InsertShape(ShapeType.TextBox, 100, 40);
Stroke stroke = shape.Stroke;
stroke.ForeThemeColor = ThemeColor.Dark1;
stroke.ForeTintAndShade = 0.5;
doc.Save(ArtifactsDir + "Shape.StrokeForeThemeColors.docx");
Source*
Manage Bibliography Sources in Word-processing Files
- A new public bibliography API is introduced in this release. It sees a new public property
Bibliography
added to the Document
class. - New
Bibliography
, Source
, ContributorCollection
, Contributor
, Corporate
, PersonCollection
, Person
classes, and SourceType
enumeration added.
Enhance the capabilities of your document processing apps and work with different types of bibliography sources and contributors.
Please refer to the following C# code example for more information on API usage:
/// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-.NET.git.
Document document = new Document(MyDir + "Bibliography sources.docx");
Bibliography bibliography = document.Bibliography;
Assert.AreEqual(12, bibliography.Sources.Count);
Source source = bibliography.Sources.FirstOrDefault();
Assert.AreEqual("Book 0 (No LCID)", source.Title);
ContributorCollection contributors = source.Contributors;
PersonCollection authors = (PersonCollection)contributors.Author;
Assert.AreEqual(2, authors.Count());
Person person = authors.FirstOrDefault();
Assert.AreEqual("Roxanne", person.First);
Assert.AreEqual("Brielle", person.Middle);
Assert.AreEqual("Tejeda", person.Last);
Source*
Control Access to Member Types in Reporting Engine
It is now possible to limit access to members belonging to specific types by utilizing the LINQ reporting engine template syntax.
Take report security to the next level with the advanced features in this release of the .NET API.
Using the C# coding sample provided below, you can learn to apply limitations to accessing unsafe types:
// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-.NET.git.
Document doc = DocumentHelper.CreateSimpleDocument("<<var [typeVar = \"\".GetType().BaseType]>><<[typeVar]>>");
// Note, that you can't set restricted types during or after building a report.
ReportingEngine.SetRestrictedTypes(typeof(System.Type));
// We set "AllowMissingMembers" option to avoid exceptions during building a report.
ReportingEngine engine = new ReportingEngine() { Options = ReportBuildOptions.AllowMissingMembers };
engine.BuildReport(doc, new object());
// We get an empty string because we can't access the GetType() method.
Assert.AreEqual(string.Empty, doc.GetText().Trim());
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.1 Release Notes.