Humble Seeker Posted November 3, 2003 Posted November 3, 2003 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 "l+" Cell.Texts.item(1).TextContents = "c" Case "l" Cell.Texts.item(1).TextContents = "a" Case "m" Cell.Texts.item(1).TextContents = "b" 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. Quote
Humble Seeker Posted November 10, 2003 Author Posted November 10, 2003 I figured it out. I got it to work using the following code. Private Sub bulletChange(ByVal tableObject) Dim firstInstance As Integer = 0 Dim mySelection = mInDesign.Selection Dim mTableCell 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 "l+" Cell.Texts.item(1).TextContents = "c" If firstInstance = 0 Then firstInstance = Cell.index End If Case "l" Cell.Texts.item(1).TextContents = "a" If firstInstance = 0 Then firstInstance = Cell.index End If Case "m" Cell.Texts.item(1).TextContents = "b" If firstInstance = 0 Then firstInstance = Cell.index End If End Select End If Next If firstInstance > 0 Then mTableCell = tableObject.Cells.ItemByRange(tableObject.cells.item(firstInstance), tableObject.cells.item(Cell.index)) mInDesign.Selection = mTableCell mySelection = mInDesign.Selection mySelection.Item(1).VerticalJustification = InDesign.idVerticalJustification.idTop mySelection.Item(1).texts.item(1).AppliedFont = mFont firstInstance = 0 End If End If statusOfFormat.CurrentProgressBar.PerformStep() Next End Sub Probably of no use to anyone else, but.... Quote
Recommended Posts