ComponentOne VSView 8.0
Hints and Troubleshooting
  1. How can I clear the contents of the VSPrintercontrol?

    Use the Clear method.

  2. How can I use printer fonts with VSPrinter?

    Just assign the font name to the Font.Nameor FontName properties as usual. The preview will look a little different from the printed output, because Windows will have to select the screen font that best approximates the printer font you selected, and the match won't be perfect.

    Using printer fonts has one additional point that may cause some confusion. If you read the font name back from the FontName property, it will return the actual printer font name. But if you read it back from the Font.Nameproperty, you will get the name of the screen font instead. This happens because FontName returns the original name that was assigned to the property, while the Font object returns the name of the screen font that best approximates the original selection.

    For example, assuming that vp is a VSPrinter control:

    Example Title
    Copy Code
    ?vp.Device
    
      HP LaserJet 4L
    
    vp.FontName = "Antique Olive"
    
    ?vp.FontName
    
      Antique Olive
    
    ?vp.Font.Name 
    
      Times New Roman
    
  3. Why do so many methods have parameters of type Variant?

    Only Variant parameters can be specified as optional. A Boolean parameter, for example, cannot be optional. This is part of the ActiveXarchitecture.

    Many VSPrinter methods have optional parameters, because default values are provided that handle the vast majority of the calls. All of these must be of type Variant.

    Also, VSPrinter allows you to use unit-aware measurements, which can be specified as strings or numbers, and thus need to be of type Variant. For example:

    Example Title
    Copy Code
    vp.MarginLeft =  "2.2in"
    
    vp.SpaceAfter = 300 ' twips
    
  4. How can I include Pictures, Headers, and Footers in my RTF output files?

    Pictures, headers, and footers are not automatically included in VSPrinter8 RTF or HTMLexport files. You can include them using the ExportRaw property. For example, the following routine includes a picture file into RTF or HTML export files:

    Example Title
    Copy Code
    Sub ExportPicture(vp As VSPrinter, sPicFile As String)
    
     
    
      ' no export file? no work!
    
      If Len(vp.ExportFile) = 0 Then Exit Sub
    
       
    
      ' HTML
    
      If vp.ExportFormat < vpxRTF Then
    
        Dim ml!
    
        ml = vp.IndentLeft / 1440
    
        vp.ExportRaw = vbCrLf & _
    
              "<img style='margin-left:" & _
    
              ml & "in;' src=" & sPicFile & ">" & vbCrLf
    
        Exit Sub
    
      End If
    
       
    
      ' RTF
    
      Dim sPicFileEsc$
    
      sPicFileEsc = Replace(sPicFile, "\", "\\\\")
    
           
    
      ' save it
    
      vp.ExportRaw = vbCrLf & _
    
              "{\field{\*\fldinst { INCLUDEPICTURE " & _
    
              sPicFileEsc & " \\* MERGEFORMAT \\d }}}" & vbCrLf
    
    End Sub
    

    For a more complete example, including headers and footers, see the PicExport sample on the HelpCentral Samples page.

  5. How can I make table cells break across page breaks?

    By default, VSPrintertries to keep table rows together on a page. If a cell contains a lot of text, though, you may want to allow the row to break across page breaks. To do this, set the TableCell (tcRowKeepTogether) property to False.

 

 


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

Product Support Forum  |  Documentation Feedback