PDA

View Full Version : SelText and tables?


Tom Kenney
January 25, 2007, 03:08:09
I'm using V12.0, C++ wrapper derived from the ActiveX Server OCX, and doing MS Word document conversion to ASCII text.

I'm trying to replace a whole table with a replacement string. If I find the starting and ending positions of the table, then use SetSelStart and SetSelLength to set the selection, SetSelText 'beeps' and does not perform the replacement. It also does not return an error or display a dialog with an error. As a test, I can insert my replacement text anywhere except to replace the table.

Is there a way to delete the whole table in one swipe? I've tried TableDeleteLines and TableDeleteColumn to remove the table, but this seems to delete the contents of the table but leave some kind of table markers that interfere with replacement and finding the next table.

TIA.

Gunnar Giffey
January 25, 2007, 15:37:18
Hi Tom,

Could you test the following code in your app and get back to this thread with the results?
The code snippet assumes a table id of 11 for the table!
TXTextControl1.SelStart = TXTextControl1.TableCellStart(11, 1, 1) - 1
TXTextControl1.SelLength = TXTextControl1.TableCellStart(11, TXTextControl1.TableRows(11), TXTextControl1.TableColumns(11)) + TXTextControl1.TableCellLength(11, TXTextControl1.TableRows(11), TXTextControl1.TableColumns(11)) - TXTextControl1.TableCellStart(11, 1, 1)
TXTextControl1.TableDeleteLines

Tom Kenney
January 25, 2007, 20:17:09
Thanks. I'll give it a try this afternoon and report results.

Tom Kenney
January 27, 2007, 02:34:18
Though I will try the code snippet you've posted, I haven't yet had time. Trying to meet a deadline. What I've done as a work-around is to find the table, insert FORE and AFT tags, then extract the text from that section (header, footer, body), then do the replacement on the extracted string.

Other than this (minor!) issue, we're having great success with TextControl. Thanks!