Error processing large tables

P

PromisedOyster

We are using Word Automation within a C#/WinFroms application.

One of the things that this program does is set the alignment of all
columns in a table.

The code snippet is as follows.


for (int column = 1; column < columns + 1; column++)
{
Word.WdParagraphAlignment alignment =
(Word.WdParagraphAlignment)alignments[column-1];
for (int row = fieldRow; row < table.Rows.Count + 1; row++)
{
table.Cell(row, column).Range.ParagraphFormat.Alignment =
alignment;
}
}


This works very well. However, if there are a large number of rows in
the table, eg > 500 then setting the alignment does not work for all
rows. It appears to do so many and then stop. The number of rows it
processes can vary from one time to another.

Any ideas on how to workaround this issue?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top