Free Support Forum - aspose.com

MoveToCell error

I am trying to use the MoveToCell method and I am getting an error of "Cannot find a table with the specified index."

As far as I can tell, I only have two tables in my Word document. Do I have to mark the table in some fashion? I’m assuming that the tableIndex parameter is zero based.

If you could supply an example, it would be appreciated.

I have realized that I need to move to something prior to MoveToCell, so I moved to the section that contains the table and then called the MoveToCell. This is a little confusing since MoveToMergeField worked without necessitating a move to a section.

I now have another problem. I need to change the Background pattern of a cell that already exists.

after I perform the following steps…


builder.MoveToCell(1, 1, Total, 0)builder.CellFormat.Shading.BackgroundPatternColor = Color.LightGreen

The Word doc does not have a changed cell background.

Do I need to take some kind of action once I set the BackgroundPatternColor?

Thank you for your help

You are right, MoveToCell moves the cursor to a table cell in the current section.

Strictly speaking, DocumentBuilder was not designed to allow modification or removal of existing document content or formatting. It was mostly designed to allow inserting more content.

Sure, we want to allow full document content manipulation, similar to MS Word object model, but it is quite difficult technically and we still have to do lots of work on this.

In the meantim we evolve DocumentBuilder to make it as useful as we can. So far only ParagraphFormat and PageSetup objects take on formatting properties of the current paragraph of section when you move the cursor.

CellFormat remains just a copy of formatting which is used to derive formatting for all newly inserted cells. This is why changing CellFormat does not change any existing cells.

I’ll log your request, but I cannot promise a delivery date at this stage. It could be 1-2 months.