Awais Hafeez June 19, 20190 Comments

Read VBA Macros, Convert to Horizontally Merged Cells, Compress Metafiles, Add Table Styles using Aspose.Words for Java 19.6

Read VBA Macros, Convert to Horizontally Merged Cells, Compress Metafiles, Add Table Styles using Aspose.Words for Java 19.6

June 19, 2019
Share on FacebookTweet about this on TwitterShare on LinkedIn

In this post, I will enlist/explain new features introduced in Aspose.Words for Java 19.6 release.

Access/Read VBA Macros from Word Document

Aspose.Words now provides three classes to get access to the VBA project source code. The VBAProject class provides access to VBA project information, the VbaModuleCollection class returns collection of VBA project modules and VbaModule class provides access to the VBA project module. The code example given below shows how to read VBA Macros from the Word document:

Convert to Horizontally Merged Table Cells

In the latest versions of MS Word, Table cells are merged horizontally by their width. Whereas, the merge flags were used in the older technique, like Cell.CellFormat.HorizontalMerge. The merge flags are not used when cells are horizontally merged by their width and it is also not possible to detect which cells are merged. Aspose.Words now provides ConvertToHorizontallyMergedCells method to convert cells which are horizontally merged by their widths to the cell horizontally merged by flags. It simply transforms the table and adds new cells when needed.

The following code example shows the working of the above-mentioned method.

Compress Metafiles in Word Document

In MS Word, all the metafiles are compressed by default regardless of their size. However, Aspose.Words used to compress large metafiles only and smaller ones were not compressed just because of better performance. Aspose.Words now provides a property AlwaysCompressMetafiles, to facilitate the users if they want to compress all the metafiles either large or small. Its default value is true which means that all metafiles shall be compressed regardless of their sizes and false means that small metafiles shall not be compressed for performance reason.

Working with Table Styles

You can change the format of Table by using Table styles in MS Word. With Table style, you can change the look of Table e.g. border, shading, alignment, text font etc. In this release of Aspose.Words, new public properties have been added into the TableStyle class. We have implemented new public types ConditionalStyleCollection, ConditionalStyle, and ConditionalStyleType. Please read the following article for more details.

Working with Table Styles

License.IsLicensed Marked as Obsolete

Starting from Aspose.Words 19.6, the License.IsLicensed property is marked as obsolete. We will remove it in later releases

/// <summary>
/// Returns true if a valid license has been applied; false if the component is running in evaluation mode.
/// </summary>
[Obsolete("This property is obsolete. SetLicense() method raises an exception if license is invalid.")]
public bool IsLicensed

Obsolete methods Range.Replace Removed

We have removed the following Range.Replace methods from Aspose.Words API.

public int Replace(string pattern, string replacement)
public int Replace(string pattern, string replacement, FindReplaceOptions options)
public int Replace(Regex pattern, string replacement)
public int Replace(Regex pattern, string replacement, FindReplaceOptions options)

See also Useful Links

Keeping the Aspose tradition, you are welcome to shape the upcoming releases of Aspose.Words for Java API by posting your suggestions and concerns in the Aspose.Words for Java Support Forum.

Leave a comment

Posted inAspose.Words Product Family
 

Related Articles