Free Support Forum - aspose.com

Error when ending a table with empty cells

I've not narrowed down a piece of example code yet, but preliminary testing seems to show that if you create a table and add cells with no content, when you attempt to close the table you get an error along the lines of "unable to close table at this time".

What are the limitations in the table generation code (using the documentbuilder), and is it possible to request the state of the builder to see if you are allowed to close the table at the current time?

Cheers,
Jason

Hi

Thanks for your request. May be this problem occurs because you didn’t finish the row. The following code works fine on my side.

builder.InsertCell();

builder.InsertCell();

builder.EndRow(); //finish the row

builder.EndTable();

I hope that it will help you.

Best regards.

Thanks for the speedy response, but I guessed the same thing, and found that adding the EndRow function raised an error saying that this was an invalid point to end the row.

I traced the code and found that I was making a number of changes to paragraph formats in the empty cell, so I'm wondering if that has some bearing on the problem.

I'll try and isolate a code sample. This was just a quick inquiry to see if there was a known rule underwhich this error might be raised. Tracing the exact cause is tricky because it's a recursive document generator, but I'll see what I can do.

Thanks,
Jason

Ah, please ignore this thread. It was a complex issue with empty tags during recursion in reading an XML stream that was skipping a close row tag in some cases but not in others.

Thanks for the help and suggestions though.

Cheers,
Jason

Hi

<span style=“font-size: 12pt; font-family: “Times New Roman”;”>It is very nice that you
have found the solution independently.

Best regards.