Browse our Products

Aspose.Words for Java 23.7 Release Notes

Major Features

There are 118 improvements and fixes in this regular monthly release. The most notable are:

  • The possibility to save the document page or shape into EPS format has been implemented.
  • The ability to retrieve the digital signature value from a digitally signed document as a byte array has been added.
  • The Row and Cell classes have been extended with new public members.
  • Mustache tags are now supported in the MailMerge.GetRegionsHierarchy and MailMerge.GetFieldNamesForRegion methods.
  • The LINQ Reporting Engine template syntax now supports the ElementAt and ElementAtOrDefault extension methods.

Full List of Issues Covering all Changes in this Release

Public API and Backward Incompatible Changes

This section lists public API changes that were introduced in Aspose.Words 23.7. It includes not only new and obsoleted public methods, but also a description of any changes in the behavior behind the scenes in Aspose.Words which may affect existing code. Any behavior introduced that could be seen as regression and modifies the existing behavior is especially important and is documented here.

Added ability to get digital signature value from digitally signed document as byte array

Related issue: WORDSNET-25420

Added ability to get a digital signature value from a digitally signed document into Aspose.Words.DigitalSignatures.DigitalSignature class:

/// <summary>
/// Gets an array of bytes representing a signature value.
/// </summary>
public byte[] SignatureValue { get; }
Document doc = new Document("docWithSign.docx");

foreach (DigitalSignature digitalSignature in doc.DigitalSignatures)
{
    string signatureValue = Convert.ToBase64String(digitalSignature.SignatureValue);
    Console.WriteLine("Base64 signature value is: {0}", signatureValue);
}

// The code produces the following output:
// Base64 signature value is: AJjRFbflcj+H7VUZ9Q/9rpbavjT7TC10M5orYCRYnEIwyPCtTman8+na4ynclQtBFFgT7uJoHyuHStleXwnbbj6AVNp/B1oCtlEcg9t7WjsgLlm7LQsr6PCCCkgWYNEOwe3s6Wpfop9qkyEEBxATgfpfbbdodB/wO0elS/Ei+dfUmu

Added new EPS image format

Related to WORDSNET-24195

The document page or shape could be saved into EPS format now. A new EPS value is added into SaveFormat enum.

// Open some document.
Document doc = new Document("document.docx");

// Save the second page as EPS image.
ImageSaveOptions saveOptions = new ImageSaveOptions(SaveFormat.Eps);
saveOptions.PageSet = new PageSet(1);
doc.Save("image.eps", saveOptions);
// Open some document.
Document doc = new Document("document.docx");

// Save the shape as EPS image.
ImageSaveOptions saveOptions = new ImageSaveOptions(SaveFormat.Eps);
Shape shape = (Shape)doc.GetChild(NodeType.Shape, 0, true);
ShapeRenderer renderer = shape.GetShapeRenderer();
renderer.Save("image.eps", saveOptions);

Added new public properties Row.NextRow, Row.PreviousRow, Cell.NextCell and Cell.PreviousCell

Related issue: WORDSNET-24965

The following public properties have been added to the Row class:

/// <summary>
/// Gets the next Row node.
/// </summary>
/// <remarks>
/// The method can be used when you need to have typed access to table rows.
/// If a StructuredDocumentTag node is found in a table instead of a row,
/// it is automatically traversed to get a row contained within.
/// </remarks>
public Row NextRow { get; }

/// <summary>
/// Gets the previous Row node.
/// </summary>
/// <remarks>
/// The method can be used when you need to have typed access to table rows.
/// If a StructuredDocumentTag node is found in a table instead of a row,
/// it is automatically traversed to get a row contained within.
/// </remarks>
public Row PreviousRow { get; }

The following public properties have been added to the Cell class:

/// <summary>
/// Gets the next Cell node.
/// </summary>
/// <remarks>
/// The method can be used when you need to have typed access to cells of a row.
/// If a StructuredDocumentTag node is found in a row instead of a cell, it is automatically
/// traversed to get a cell contained within.
/// </remarks>
public Cell NextCell { get; }

/// <summary>
/// Gets the previous Cell node.
/// </summary>
/// <remarks>
/// The method can be used when you need to have typed access to cells of a row.
/// If a StructuredDocumentTag node is found in a row instead of a cell, it is automatically
/// traversed to get a cell contained within.
/// </remarks>
public Cell PreviousCell { get; }

Document doc = new Document(fileName);
Table table = doc.FirstSection.Body.Tables[0];

// Enumerate through all cells of the table.
for (Row row = table.FirstRow; row != null; row = row.NextRow)
{
    for (Cell cell = row.FirstCell; cell != null; cell = cell.NextCell)
    {
        Console.WriteLine(cell.GetText());
    }
}

A warning is issued if loaded HTML document has fixed-page structure

Related issue: WORDSNET-25035

Aspose.Words doesn’t support loading of fixed-page HTML document (for example, documents that are produced when saving in SaveFormat.HtmlFixed). If Aspose.Words detects that the loaded HTML document has fixed-page structure, it will issue the following warning:

WarningSource.Html
WarningType.MajorFormattingLoss
"The document is fixed-page HTML. Its structure may not be loaded correctly."

Supported mustache tags in the MailMerge.GetRegionsHierarchy and MailMerge.GetFieldNamesForRegion methods

Related issue: WORDSNET-25404

Now the MailMerge.GetRegionsHierarchy method returns mustache regions and mustache fields when the MailMerge.UseNonMergeFields option is true.

Now the MailMerge.GetFieldNamesForRegion method accepts mustache region names and returns mustache field names when the MailMerge.UseNonMergeFields option is true.

The MustacheTag class has been introduced:

/// <summary>
/// Represents "mustache" tag.
/// </summary>
public class MustacheTag
{
    /// <summary>
    /// Gets the run that contains the beginning of the tag.
    /// </summary>
    public Run ReferenceRun { get; }

    /// <summary>
    /// Gets the zero-based starting position of the tag from the start of the <see cref="ReferenceRun"/>.
    /// </summary>
    public int ReferenceOffset { get; }

    /// <summary>
    /// Gets the text of the tag.
    /// </summary>
    public string Text { get; }
}

The StartMustacheTag, EndMustacheTag and MustacheTags properties have been added to the MailMergeRegionInfo class:

public class MailMergeRegionInfo
{
    /// <summary>
    /// Returns a start "mustache" tag for the region.
    /// </summary>
    public MustacheTag StartMustacheTag { get; }

    /// <summary>
    /// Returns an end "mustache" tag for the region.
    /// </summary>
    public MustacheTag EndMustacheTag { get; }

    /// <summary>
    /// Returns a list of child "mustache" tags.
    /// </summary>
    public IList<MustacheTag> MustacheTags { get; }
}

Document document = new Document("Template.docx");
document.MailMerge.UseNonMergeFields = true;

MailMergeRegionInfo hierarchy = document.MailMerge.GetRegionsHierarchy();

foreach (MustacheTag mustacheTag in hierarchy.MustacheTags)
    Console.WriteLine(mustacheTag.Text);

foreach (MailMergeRegionInfo region in hierarchy.Regions)
{
    Console.WriteLine(region.StartMustacheTag.Text);
    Console.WriteLine(region.EndMustacheTag.Text);
}

Supported ElementAt and ElementAtOrDefault extension methods for LINQ Reporting Engine template syntax

Related issue: WORDSNET-25259

From now on, you can use ElementAt and ElementAtOrDefault extension methods within LINQ Reporting Engine template syntax as follows:

<<[persons.ElementAt(3).Name]>>
<<[persons.ElementAtOrDefault(5)?.Name]>>