Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

InDesign Table Select with VB

Status
Not open for further replies.

HumbleSeeker

Programmer
Nov 29, 2002
37
0
0
GB
I'm using Visual Basic .Net to create an automated function for Adobe InDesign 2.0.2

The problem I'm having is that I wish to select every cell in a row, except the first one, and then apply a specific font to it.

Source Code below:

Private Sub bulletChange(ByVal tableObject)
For Each Row In tableObject.Rows
If Row.Cells.Item(1).Texts.item(1).pointsize = 8 Then
For Each Cell In Row.Cells
' a = l, b = m, c = l+
If Cell.Texts.item(1).TextContents.length < 3 And Cell.Texts.item(1).TextContents.length > 0 Then
Select Case Cell.Texts.item(1).TextContents
Case &quot;l+&quot;
Cell.Texts.item(1).TextContents = &quot;c&quot;
Case &quot;l&quot;
Cell.Texts.item(1).TextContents = &quot;a&quot;
Case &quot;m&quot;
Cell.Texts.item(1).TextContents = &quot;b&quot;
End Select
Cell.Texts.item(1).AppliedFont = mFont
End If
Next
End If
statusOfFormat.CurrentProgressBar.PerformStep()
Next
End Sub

I've got this far. I can select the cells individually and apply the font, but it's too slow for the purpose I need of it.

Anyone got any ideas how I can do this?

Thanks for taking the time to look.


Humble Seeker
-----------------------------------------------------
The longest journey begins with the smallest step.
 
hi

you must use ItemByRange ... like when selecting characters ...

Dim myInDi As InDesign.Application
Dim myTable As InDesign.Table
Dim myRow as Long

myInDi.Select myTable.Cells.ItemByRange(myTable.Cells.Item("2:" + Str(myRow)),myTable.Cells.Item(Str(myTable.Rows.Item(myRow).ColumnCount)+ ":" + Str(myRow))

BUT ... you'll have error when any cell in selection range is "bigger" (merget vertically) or any cell on start/end of selection is merged verticall, too ...

I don't know asnwer for this problem - AdobeShare "don't know", too ...

but I wrote script for editing tables, script doing:
- merge empty cells (vertically) and create "logical" rows
- delete number of "logical" rows from current cursor position
- (re)number "logical" rows from cursor position with specified start number
- convert Table to TAB separated text ... breaking merged cells (I add option to not_copy_content_of_top_cell)

(after convert TAB delimited text to table) ...

Robin

Scripts for InDesign
gg 3753393
Skype: indesignscripts
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top