It seems that you are encountering an issue with the foreach tag in your Aspose.Words implementation, specifically with the syntax used for generating a horizontal table. The error message indicates that the tag is not well-formed due to the unexpected character ‘-’.
To resolve this issue, you can try the following approaches:
Correct the Syntax: Ensure that the syntax for the foreach tag is correctly formatted. The correct format should not include any unexpected characters. For example, you might want to use:
<<foreach [data in Data]>>
Use DocumentBuilder: If you are looking for an alternative method to generate tables, consider using the DocumentBuilder class. This class provides a straightforward way to create and manipulate tables programmatically. Here’s a simple example of how to create a table using DocumentBuilder:
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Start the table
builder.StartTable();
// Insert cells
builder.InsertCell();
builder.Write("Cell 1");
builder.InsertCell();
builder.Write("Cell 2");
builder.EndRow();
builder.InsertCell();
builder.Write("Cell 3");
builder.InsertCell();
builder.Write("Cell 4");
builder.EndRow();
// End the table
builder.EndTable();
// Save the document
doc.Save("TableExample.docx");
Check for Updates: Since you are using an older version of the Aspose library (23.5.0), consider updating to the latest version. Newer versions may have improvements and bug fixes that could resolve your issue.
If you continue to experience problems, please provide more details about your implementation, and I would be happy to assist further!