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. Image for the cookie policy date
close icon

Generating table rows and preserved formats

Hi,

I'm tyring to create docs from a template doc where I have to fill in data into predefined tables. In the template the tables already exist and are formatted. Each of such tables has two rows, first one with captions, second one with a placeholder in the most left cell.

In my programm I scan for tables with these placeholders. Once I found one I get the row with the placeholder into a variable and remove it from the table. Then for each data to insert I add a cloned copy of the removed row as it contains the formats defined in the template. So more less like this:

if (IsTemplateTable(table))
{
WTableRow templateRow = table.Rows[1];
table.Rows.RemoveAt(1);
foreach (Data data in MyData)
{
int index = table.Rows.Add(templateRow.Clone());
table.Rows[i].Cells[0].Paragraphs[0].Text = data.ID;
table.Rows[i].Cells[1].Paragraphs[0].Text = data.Value;
}
}

Building the table works fine but it does not preserve the original formats. Instead the text in the table cells have standard format and the formats of the template doc are not there. Even if I just set Paragraph.Text of the original row in the template row to another text it has the standard format afterwards.

How can I set a new text (not replacing as most cells are just empty) to a cell while preserving or applying the original format.

Thanks in advance,
Christian













1 Reply

GT Gunasekaran T Syncfusion Team November 23, 2011 06:15 AM UTC

Hi Christian,

Thank you for your interest in Syncfusion products.

We are not able to reproduce the mentioned issue with preservation of the formatting’s for the rows inserted to the table using DocIO. For your reference we have attached the sample used to test the mentioned issue on our side. Please do find the sample from the following location. Try the attached sample and let us know if this helps you.

Sample link:
http://www.syncfusion.com/downloads/Support/DirectTrac/78124/Sample-104231007.zip

If you are not able reproduce the mentioned issue with attached sample, please modify the sample to reproduce the issue and provide us the modified sample for further analysis.

Please let us know if you have any other questions.

Regards,
Gunasekaran



Loader.
Live Chat Icon For mobile
Up arrow icon