I have two tables - Offeirng and Projects. An offering can have one or more than one projects associated with it. So the offering info is generated once and the project info gets repeated as per the no. of projects associated with the offering .
…
Now suppose if there is an offering which does not has any projects associated with it. In that case I want to hide the project table and show only the offering part.
How is this possible?
Hi
Thanks for your request. You can remove this table during mail merge. Also please attach your template and some code that you use to execute mail merge. Then I will investigate the template and code and try to help you.
Best regards.
I am attching the template with this post.
protected void Page_Load(object sender, EventArgs e)
{
private int _offeringId = Convert.ToInt32(Request.QueryString["offId"].ToString());
private string _criteriaId = Request.QueryString["rptCat"].ToString();
if (!IsPostBack)
{
// Fuunction Call To Set The License File
getLicense();
DataTable dtOfferings = ObtainOfferingBudgetSummaryData();
if (dtOfferings.Rows.Count > 0)
{
// Iff the Datatable returns any Rows then only the CreateAsposeReport function will get called
CreateAsposeReport(dtOfferings);
}
}
}
protected void CreateAsposeReport(DataTable dt)
{
// Call to Mail Merge Field Event Handler
}
private void MailMerge_MergeField(object sender, MergeFieldEventArgs e)
{
// If the field is from projects table and the merge filed does not has a value
if (e.FieldName == "notable_points")
{
// Delete the project table entirely along with all other merge fields of the project table
}
}
How can this be done…
Please help me with this Aspose Guys!!!
Hi
Please reattach your template.
<span style=“font-size: 12pt; font-family: “Times New Roman”;”>Best regards
Please find attached the template with this post. Suggest me a way.
Hi
Thanks for additional information. I think that you should place your “OfferingandRoadMapTable” and “Projects” in the different sections. Then if you have no projects you can move to the projects section and remove it. See the following code example.
Document doc = new Document(@"186_94192_sid8181\in.doc");
DocumentBuilder builder = new DocumentBuilder(doc);
DataTable dt = new DataTable("Projects");
if (dt.Rows.Count <= 0)
{
builder.MoveToMergeField("Projects");
builder.CurrentSection.Remove();
}
doc.Save(@"186_94192_sid8181\out.doc");
Also see the attachment. There is the modified template.
I hope that it will help you.
Best regards.
Thanks for the help SV. This code will be beneficial enough for me to solve the problem.
Anyways I have found a different thread concerning to my problem.
I donot have to do this thing according to the above thread if I coded it right.
Hope this helps other users in distress.