Showing shapes/images dynamically

Hi

Thank you for additional information. Your code works without any issues on my side. I think, you should also make sure that column names in your data source match merge field names in your template. Could you please provide me your sample data source? Or just create simple console application, which I can run on my side and reproduce the problem.
Best regards,

Hi,
are you asking for the code which fills the datatable? if so, please find below:

private DataTable GetKeyRiskAreas(string AuditNumber, int Version)
{
    AuditKeyRiskAreasResults KeyRiskAreas = new AuditKeyRiskAreasResults();
    KeyRiskAreas.Where.AuditNumber.Value = AuditNumber;
    KeyRiskAreas.Where.AuditNumber.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal;
    KeyRiskAreas.Where.Version.Value = Version;
    KeyRiskAreas.Where.Version.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal;
    KeyRiskAreas.Query.Load();
    DataTable table = new DataTable("KeyRiskAreas");
    table.Columns.Add("KeyArea");
    table.Columns.Add("Rating");
    table.Columns.Add("Summary");
    table.Columns.Add("#Issues");
    do
    {
        int RatingId = 0;
        if (KeyRiskAreas.s_RatingId != "")
            RatingId = KeyRiskAreas.RatingId;
        table.Rows.Add(new object[] { MstKeyRiskArea.GetKeyRiskAreaById(KeyRiskAreas.KeyRiskAreaId), RatingId, KeyRiskAreas.KeyIssuesSummary, KeyRiskAreas.NoofIssues });
    }
    while (KeyRiskAreas.MoveNext());
    return table;
}
public string GetPDFPreview(AuditReportSection section, Object content, String wordTemplatePath)
{
    AsposeWords asposewords;
    ListDictionary ld;
    ListDictionary ld1;
    DataTable KeyRiskAreas = null;
    string ms = "";
    string seperator = "^";
    System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
    asposewords = new AsposeWords(wordTemplatePath);
    DataTable HeadersTable = GetHeaderInfo(intro.AuditNumber, intro.Version);
    DataTable KeyRiskAreas = GetKeyRiskAreas(intro.AuditNumber, intro.Version);
    ms = asposewords.ConstructPreview(ld, System.IO.Path.GetDirectoryName(wordTemplatePath), HeadersTable, KeyRiskAreas);
    return ms;
}

Please let me know if something wrong with this code?

Hi

Thank you for additional information. In your template document you specified the table name as “KeyRisk” but in you code you specified the table name as “KeyRiskAreas”. They should be the same

DataTable table = new DataTable("KeyRisk");
table.Columns.Add("Rating");
table.Columns.Add("Summary");
table.Columns.Add("Issues");
Please see the following link

https://docs.aspose.com/words/net/types-of-mail-merge-operations/
Best regards,

hurrayyyyy it workeddddddd thanx a lot!!! i didnt know tht the table name and MergeField table name should be the same :frowning: and had been struggling for some time… appreciate ur valuable help… thanx alot once again!!