ComponentOne VSView 8.0
Shaded Table

This example shows how you can use the AddTable method to draw a table with rows of alternating colors.

Example Title
Copy Code
Sub ShowTable()

 

  ' create format string (widths in Twips)

  Dim f$

  f = "+1440|+^1000|+^1000|+>700;"

 

  ' create header string (repeat across page breaks)

  Dim h$

  h = "Network|Country|Language|Code;"

 

  ' create some dummy data

  ReDim b$(7)

  b(1) = "Cartoon Network|USA|English|CAR;"

  b(2) = "Deutsche Welle|Germany|German, English|DWL;"

  b(3) = "Discovery|USA|English, Spanish|DCY;"

  b(4) = "FOX|USA|English|FOX;"

  b(5) = "TV5|Canada, France|French, Spanish|TV5;"

  b(6) = "MTV|USA|English, Spanish|MTV;"

  b(7) = "RAI Uno|Italy|Italian, English|RAI;"

 

  ' start document

  vp.StartDoc

 

  ' show header and green first row

  vp.AddTable f, h, b(1), vbYellow, vbGreen

 

  ' append row pairs (white, green)

  Dim i%

  For i = 2 To 6 Step 2

    vp.AddTable f, h, b(i), vbYellow, , True

    vp.AddTable f, h, b(i + 1), vbYellow, vbGreen, True

  Next

 

  ' done

  vp.EndDoc

 

End Sub

The above code creates this output:

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback