Free Support Forum -

Deletion feature request

Request for features, summary:
. delete a bookmark range
. detect and delete a blank table row

I’m in the process of developing a word application for creating customized insurance contract documents. I’ve run into performance problems using word automation and am attempting to convert to aspose.word.

The documents are fairly complex with over 100 merge fields and several places with alternate text clauses. To ease maintenance, all alternative text fragments, each fragment individually bookmarked, are placed in a single template document. A finished output document is created by deleting the non-applicable text fragments, and filling the merge fields. In word automation, a non-applicable text fragment is deleted with a .range.delete() call.

The document is laid out with tables and there are a few nested tables. There are cases where the entire contents of a table row is deleted- in which case, the empty table row needs to be deleted. In word automation this is done by scanning all tables and detecting and deleting empty rows, as in the vb code fragment below. The use of nested tables seems to preclude the use of sections to enclose alternate/deletable fragments.

Are deletion features like this planned for Aspose.word any time soon?

Thanks in advance.

-Charu Tevari

Sub deleteBlankRows() ‘’'delete blank rows in all tables in the document
For Each tbl In doc.Tables
For Each row In tbl.Rows
For Each cell In row.Cells
Dim rng As Word.Range = cell.Range()
'ignore end of cell character
If rng.Text.Substring(0, rng.Text.Length - 2) <> “” Then
rowEmpty = False
Exit For
End If
If rowEmpty Then row.Delete()
End Sub

Thanks, this is a good feature request.

As you can see Range in Aspose.Word is not as powerful as in MS Word yet, but we are working to make it as similar to MS Word as possible. Bookmark deletion will be added soon, let’s say early August. I’ll see if I can do row deletion too.