Access violation getting child nodes

I have this line of code in my delphi application.
if (dbTable.Cell(1,1) <> nil) and
(dbTable.Rows <> nil) and
(dbTable.Rows.Count = 1) and
(dbTable.Rows.Item(1).Cells.Count = 1) and
(dbTable.Cell(1, 1).Range.Text = ‘’) then
begin
if (dbTable.Cell(1, 1).AsposeCell.GetChildNodes($00000012, true) <> nil) then – blows up right here.

It seems to have worked when I was using aspose.words 18.4.
I recently updated to 19.10, and it is blowing up.
any help would be appreciated:
I am trying to check to see if the cell has an embedded table or an embedded image (shape).

@conniem,

Please ZIP and upload your input Word document you are getting this problem with here for testing. We will then investigate the issue on our end and provide you more information.

attached.
the table it’s having issues with is the ones labeled ‘contactname’
03 no date.zip (6.6 KB)

my logic adds a row, then deletes the first row. then that code bombs out.
I don’t have the time atm to isolate it further than that (as in, does it do that without the additional code?), but I do know it worked in 18.4 version of aspose.

@conniem,

Please check the following .NET (C#) code that adds a blank row at the end of every Table in Word document. You can translate it to Delphi on your end.

Document doc = new Document("E:\\Temp\\03 no date\\03 no date.dot");
          
foreach(Table tab in doc.GetChildNodes(NodeType.Table, true))
{
    AddBlankRow(tab);
}

doc.Save("E:\\Temp\\03 no date\\19.10.dot");

private static void AddBlankRow(Table table)
{
    // Clone the last row in the table.
    var clonedRow = (Row)table.LastRow.Clone(true);

    // Add the row to the end of the table.
    table.AppendChild(clonedRow);

    // Add top border to row
    // Remove all content from the cloned row's cells. 
    // This makes the row ready for new content to be inserted into.
    foreach (Cell cell in clonedRow.Cells)
    {
        cell.CellFormat.Borders.Top.LineStyle = LineStyle.Single;
        cell.CellFormat.Borders.Top.Color = Color.Red;
        cell.RemoveAllChildren();
        cell.EnsureMinimum();
    }
}

You can build logic on the above code to add Row(s) to the Table.

Similarly, to remove previous Row, just call the Table.Row.Remove method. For example:

targetTab.Rows[0].Remove();

right.
I have the delphi code that generates the document.
however, that delphi code calls in a custom c# dll (that was based on something from github)
that in turn, makes the aspose calls.
I’m working on deciphering how to make the aspose calls directly.

I ended up just moving the code to the c# dll, because it works fine there, just blows up on the delphi side.
Is there sample delphi code (for delphi seattle version) that I can use to write a delphi test application that makes direct aspose.word calls?

@conniem,

The best approach is to creating a Wrapper Assembly; if you need to use many of the Aspose.Words classes, methods and properties, consider creating a wrapper assembly (using C# or any other .NET programming language), that will help to avoid using Aspose.Words directly from unmanaged code.

A good approach is to develop a .NET assembly that references Aspose.Words and does all the work with it, and only exposes the minimal set of classes and methods to unmanaged code. Your application then should work just with your wrapper library.

For more details please refer to: Use Aspose.Words for .NET via COM Interop