2 Replies Latest reply on Apr 22, 2008 4:14 AM by (Dmitry1776)

    Where did i a mistake?

      After successful testing of

      b myTable.Cells.Item(3).Texts.Item(1).AppliedFont = MyInd.Fonts.Item("Castellar")

      I tryed this:
      b myTable.Cells.ItemByRange(1, -1).Item(1).Texts.Item(1).AppliedFont = MyInd.Fonts.Item("Castellar")
      - but "doesnt support"...

      Then I'd like to work with whole table, so i do a loop:

      b For Each Cell In myTable.Cells

      b myTable.Cells.Item(Cell).Texts.Item(1).AppliedFont = MyInd.Fonts.Item("Castellar")

      b Next Cell

      but i got "invalid parametr"

      How should i wright more correctly?

        • 1. Re: Where did i a mistake?
          Level 1
          > myTable.Cells.ItemByRange(1, -1).Item(1).Texts.Item(1).AppliedFont

          VB is not JS ;)

          from Olav's post:
          "In VBScript, you'll need to iterate through the returned Objects collection. When you work with ItemByRange with text, you'll get an Objects collection containing a single item, so you can avoid iteration by setting the properties of that item. For other objects, you'll get multiple objects.

          VBScript doesn't have the capability of applying a value to a property of multiple objects at once. Adding ItemByRange was about as close as we could get!"

          so - you can set fill color, stroke color or other params of Cell when you use .Cells.ItemByRange() - but you can't change Text properties of these cells in one command

          > For Each Cell In myTable.Cells
          > myTable.Cells.Item(Cell).Texts.Item(1).AppliedFont = MyInd.Fonts.Item("Castellar")
          > Next Cell

          I think "Cell" is cell-type - not long-type
          so probably you should write:

          Cell.Texts.Item(1).AppliedFont = MyInd.Fonts.Item("Castellar")

          and DON'T use For Each - becuase VB have limit to ONLY 255 items/iterations !


          • 2. Re: Where did i a mistake?
            Level 1
            OK about "For Each..." Thanks.
            And about "ItemByRange". We can apply table style to whole table (all cells), but cannot apply font, size... for whole table? Right?
            OK. We'll iterate, ... or try JS!