Symptoms
During the call ITableBlock::AddHSeparator() for an empty table, the following error is returned:
Arguments check failed. Expected: rowIdx >= 0
Cause
The exact cause of this issue is yet to be determined.
Resolution
The issue is currently under investigation.
As a workaround, you can use the repeating group as a table substitution.
You can refer to the following C# code snippets as an example:
IFieldDefinition groupTableDef = sectiondef.Fields.AddNew(FieldTypeEnum.FT_Group, "GroupTestTable");
groupTableDef.CanHaveRegion = true;
//Allow the groupTableDef to have instances
groupTableDef.IsRepeatable = true;
IFieldDefinition groupColNameDef = groupTableDef.Children.AddNew(FieldTypeEnum.FT_TextField, "ColumnName");
groupColNameDef.CanHaveRegion = true;
IFieldDefinition groupColSurnameDef = groupTableDef.Children.AddNew(FieldTypeEnum.FT_TextField, "ColumnSurname");
groupColSurnameDef.CanHaveRegion = true;
try
{
Console.WriteLine($"Open document");
IDocument doc = trainingbatch.Batch.Documents[0];
doc.Open();
try
{
Console.WriteLine($"Add table training");
IPage docpage = doc.Pages[0];
Console.WriteLine($"Find table");
IField docsection = doc.Sections.FindByName("Document Section");
for (int i = 0; i < 5; i++)
{
IField groupTable = FindField(doc.Sections, "Document Section\\GroupTestTable");
groupTable.Instances.AddNew(i);
IField Row = groupTable.Instances.Item(i);
IField col1 = Row.Children.Item(0);
IField col2 = Row.Children.Item(1);
SetFieldRegion(engineTools.Engine, docpage, col1, TableLeft, TableTop + i * RowHeight, TableCenter, TableTop + (i+1) * RowHeight);
SetFieldRegion(engineTools.Engine, docpage, col2, TableCenter, TableTop + i * RowHeight, TableRight, TableTop + (i+1) * RowHeight);
int count = groupTable.Instances.Item(i).Children.Count;
}
}
}
Comments
0 comments
Please sign in to leave a comment.