We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Alternating Rows in in table / Find text in a cell and change the cell format

Thread ID:





70309 Dec 6,2007 01:14 PM UTC Dec 10,2007 01:17 PM UTC ASP.NET Web Forms (Classic) 3
Tags: DocIO
Josue Medrano
Asked On December 6, 2007 01:14 PM UTC

I've an evaluation version of DocIO, I am trying to accomplish some requirements, so far most of then are fulfilled, however I'd like to expose the following questions:

1. Using MailMerge, is it possible to change the format of the table alternating its Background color?

2. I have a PlainText in a cell (Table) which I would to find and then change the Background of the CELL where it is placed, is is possible to do it.

If yes, could please provide me an example of it.
I appreciate your help.

Best regards,
Josue Medrano

Global Wealth Management & Business Banking
Information Technology
Tel. +41-61-288 27 62
Fax +41-61-288 20 57


Fathima Shalini P [Syncfusion]
Replied On December 7, 2007 02:22 PM UTC

Hi Joshua,

Thanks for your interest in Syncfusion Products.

1) In mail merge to set the alternate backcolor in tables we need to set the backcolor in template document. DocIO does not support this at run time. Please do find

the simple sample that illustrates setting alternate background color using mail merge.


2) Please do find the simple sample in the following link that traces a text and finds the cell and changes its background color.


The following code snippet illustrates this.


public bool Find(string str)
int k = 1;
foreach(IWSection sec in document.Sections)
foreach (IWTable table in sec.Tables)

int r = table.Rows.Count;

for (int i = 0; i < r; i++)
int c = table.Rows[i].Cells.Count;
WTableRow r1 = table.Rows[i];
for (int j = 0; j < c; j++)
if (str.Equals(r1.Cells[j].Paragraphs[0].Text))
MessageBox.Show(str + " is found in " + (i + 1) + "Row " + (j + 1) + "Cell in Table" + k, "FindOnce");
r1.Cells[j].CellFormat.BackColor = Color.Blue;
return true;
return false;


Please try this and let me know if this helps.


Josue Medrano
Replied On December 10, 2007 08:54 AM UTC

Hi Fathima,
Thank you for your answer.
For me the problem is that if I set the alternating color in the template then I have to have the specific amount of rows as result. But I have not the specific rows as result, they are the resul from a query for instance.
Is there any way to get the parent table of CurrentMergeField? if so then I can use a Handler to do the alternating format.

Fathima Shalini P [Syncfusion]
Replied On December 10, 2007 01:17 PM UTC

Hi Joshua,

To set the background color of the alternate rows, is not possible to do while mail merging the document. Please do find the simple sample in the following link.


The above sample retrieves the table from the document after the processing the mail merge and sets the background color for alternate rows.

Please let me know if this helps.



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon